:root {
  --bg: #f6f7f9;
  --text: #1c1f24;
  --muted: #5b6370;
  --accent: #1f5fae;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181d; --text: #e8eaed; --muted: #a3abb8; --accent: #7fb0ec; }
}
* { box-sizing: border-box; }
/* Ausgeblendete Elemente bleiben ausgeblendet, auch wenn eine Klasse display setzt. */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.page { max-width: 40rem; margin: 0 auto; padding: 2rem 1rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
a { color: var(--accent); }
p { color: var(--muted); }
:root { --card: #ffffff; --border: #d5d9e0; --error: #b3261e; --success: #1e7b34; }
@media (prefers-color-scheme: dark) {
  :root { --card: #1e2229; --border: #39404b; --error: #f2b8b5; --success: #8fd19e; }
}
.narrow { max-width: 26rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
label { font-weight: 600; margin-top: 0.5rem; }
input {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
button {
  font: inherit;
  font-weight: 600;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: wait; }
button.link { background: none; color: var(--accent); padding: 0; margin: 0; font-weight: 400; }
.message { margin: 0.5rem 0 0; }
.message.error { color: var(--error); }
.message.success { color: var(--success); }
.hint { font-size: 0.9rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.wide { max-width: 56rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.heading-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.heading-row h1 { margin: 0; }
.heading-row button { margin-top: 0; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.row button { margin-top: 0.75rem; }
select {
  font: inherit;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
}
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0.75rem 0 0; padding: 0.5rem 0.9rem 0.75rem; }
legend { font-weight: 600; padding: 0 0.25rem; }
label.check { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; margin-top: 0.4rem; }
label.check input { width: 1.2rem; height: 1.2rem; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.secondary.danger { color: var(--error); }
.list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.card + .card, form.card, #link-box { margin-top: 1rem; }
.employee.inactive { opacity: 0.65; }
.employee-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.badges { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.badge { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.warn { color: var(--error); border-color: var(--error); }
.muted { color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.75rem; margin: 0.5rem 0 0; font-size: 0.95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.tile {
  display: block;
  padding: 1.1rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
}
.brand { color: var(--text); text-decoration: none; font-weight: 600; }
.topbar-right { display: flex; gap: 0.75rem; align-items: center; }
#link { width: 100%; }
h3 { font-size: 1rem; margin: 1.25rem 0 0; }
section.card + section.card { margin-top: 1rem; }
.mapping-list { display: flex; flex-direction: column; }
.mapping { display: grid; grid-template-columns: 1fr; gap: 0.35rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.mapping.inactive .mapping-name { color: var(--muted); }
.mapping-name { font-weight: 600; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.mapping .row button { margin-top: 0.25rem; padding: 0.45rem 0.8rem; }
@media (min-width: 48rem) {
  .mapping { grid-template-columns: 1.4fr 1fr auto; align-items: center; }
}
select { width: 100%; }
.mapping > * { min-width: 0; }
.mainnav { display: flex; gap: 1rem; }
.mainnav a { color: var(--muted); text-decoration: none; }
.mainnav a.active { color: var(--accent); font-weight: 600; }
.topbar { gap: 1rem; flex-wrap: wrap; }
.tile.disabled { color: var(--muted); cursor: default; }
.tile small { display: block; font-weight: 400; font-size: 0.8rem; margin-top: 0.2rem; }
.tile.admin { color: var(--muted); }
.badge.ok { color: var(--success); border-color: var(--success); }
.meetings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.meeting {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.meeting.past { opacity: 0.6; }
.meeting.missing { opacity: 1; border-left: 4px solid var(--error); }
.meeting-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.meeting-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.meeting-main strong { overflow-wrap: anywhere; }
.day { margin-top: 1.25rem; }
.day h2 { display: flex; gap: 0.5rem; align-items: center; font-size: 1rem; }
.day.today h2 { color: var(--accent); }
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
.weeknav button { margin-top: 0; min-width: 3rem; }
#week-label { font-weight: 600; }
button.small { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.employee-select { margin-bottom: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
#today h2 { margin-top: 0.5rem; }
@media (max-width: 26rem) {
  .meeting { grid-template-columns: 1fr; gap: 0.25rem; }
}
/* Termin-Seite (P7) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.meeting { color: inherit; text-decoration: none; }
a.meeting:hover, a.meeting:focus-visible { border-color: var(--accent); }
.back { display: inline-block; margin-bottom: 0.75rem; text-decoration: none; }
#head h1 { margin-bottom: 0.25rem; }
#head p { margin-top: 0; }
.termin-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
.col-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.termin-grid .card { margin-top: 0; }
@media (min-width: 64rem) {
  .page.wide:has(.termin-grid:not([hidden])) { max-width: 76rem; }
  .termin-grid { grid-template-columns: 3fr 2fr; align-items: start; }
}
details.card { display: block; }
details summary { font-weight: 600; cursor: pointer; font-size: 1.05rem; }
details[open] summary { margin-bottom: 0.5rem; }
.info-field { padding: 0.5rem 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.3rem; }
.info-head { display: flex; justify-content: space-between; align-items: center; }
.info-text, .doc-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); margin: 0.25rem 0; }
textarea {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
#text { min-height: 14rem; }
.editor-foot { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; }
.warn-text { color: var(--error); font-weight: 600; }
.notice { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; margin-top: 0.5rem; }
.history { list-style: none; margin: 0; padding: 0; }
.history-item { padding: 0.6rem 0; border-top: 1px solid var(--border); }
.history-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.history-head .link { margin-left: auto; }
.search-row { display: flex; gap: 0.5rem; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { margin-top: 0; }
.results { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
button.result {
  width: 100%;
  margin: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 400;
}
button.result strong { color: var(--text); }
.doc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.doc-fields > div { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
input[type="date"] { width: 100%; }
@media (max-width: 26rem) { .doc-fields { grid-template-columns: 1fr; } }
/* Protokoll (P9) */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.filter-grid > div { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.filter-grid label { margin-top: 0; }
.audit { list-style: none; margin: 1rem 0 0; padding: 0; }
.audit-entry { display: grid; grid-template-columns: 11rem 1fr; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.audit-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.audit-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 30rem) { .audit-entry { grid-template-columns: 1fr; gap: 0.1rem; } }
