/* Design angelehnt an den Feuerwehr-Auftritt: Signalrot-Kopfleiste mit hellem
   Namens-Kasten, Overpass-Schrift, weinrote Überschriften, kantige weiße Boxen. */

@font-face {
  font-family: "Overpass";
  src: url("fonts/overpass-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #D00016;
  --red-hover: #9D0011;
  --wine: #772E37;
  --wine-dark: #52202A;
  --text: #575757;
  --muted: #717171;
  --line: #DDDDDD;
  --line-strong: #BEBEBE;
  --panel: #F0F0F0;
  --bg: #EBEBEB;
  --card: #FFFFFF;
  --ok: #2E7D32;
  --gf: #1D5FA8;          /* Gruppenführer: blau */
  --gf-bg: #E4EEF9;
  --ok-bg: #EAF4EA;
  --shadow: 0 0 17px 0 rgba(0, 0, 0, .10);
  --shadow-strong: 0 0 17px 0 rgba(0, 0, 0, .29);
  --font: "Overpass", Arial, Helvetica, sans-serif;
  --header-h: 80px;        /* Höhe der roten Kopfleiste */
  --quarter-h: 64px;       /* Höhe der festen Quartals-Überschrift */
  --mybar-h: 0px;          /* Höhe der Leiste „Deine DLK-Dienste“ (nur sichtbar beim Scrollen) */
  --mybar-full: 44px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg) linear-gradient(to bottom, #fff 0, var(--bg) 480px) no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-inline: 20px; }

/* ---------- Kopfleiste ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--red);
  box-shadow: var(--shadow-strong);
  height: var(--header-h);
}
.topbar-inner { position: relative; display: flex; align-items: center; justify-content: flex-end; height: 100%; gap: 20px; }

.brand {
  position: absolute; left: 20px; top: 0;
  /* immer klein: so hoch wie die rote Leiste (früher groß und erst beim Scrollen verkleinert) */
  width: 196px; height: var(--header-h); padding: 7px 14px 1.75px; gap: 3px;
  background: var(--panel);
  box-shadow: var(--shadow-strong);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; line-height: 1.05;
  color: var(--wine); text-decoration: none;
}
.brand:hover { color: var(--wine); text-decoration: none; }
.brand-logo { display: block; width: 100%; height: auto; }
/* Abstand Strich -> Schrift = Schrift -> Unterkante des Kastens (nachgemessen) */
.brand-name { font-size: .78rem; font-weight: 900; color: var(--wine); white-space: nowrap; padding: 5.25px 0 0; border-top: 1px solid var(--line); width: 100%; }
.brand-by { font-weight: 400; color: var(--muted); }

.topbar nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a, .topbar nav .link {
  color: #fff; font-weight: 700; font-size: .95rem; text-decoration: none;
  padding-top: 3px; /* Overpass sitzt optisch etwas hoch */
}
.topbar nav a:hover, .topbar nav .link:hover { text-decoration: underline; color: #fff; }

/* Angemeldeter Maschinist – immer sichtbar in der Kopfleiste */
.beta-badge {
  display: inline-block; padding: 3px 9px 1px; border: 2px solid #fff; color: #fff;
  font-size: .78rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; line-height: 1.3;
  white-space: nowrap; cursor: help;
}
.topbar nav a.current-user {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  background: rgba(255, 255, 255, .16); padding: 7px 12px 5px; border-radius: 999px;
}
.topbar nav a.current-user:hover { background: rgba(255, 255, 255, .28); text-decoration: none; }
.user-icon { width: 16px; height: 16px; fill: #fff; flex: 0 0 auto; margin-top: -2px; }
.current-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

/* Begrüßung ganz oben: nur groß der Vorname */
.welcome { margin: 0 0 16px; }
.welcome-title { margin: 0; font-size: 2.8rem; font-weight: 900; color: var(--wine); line-height: 1.1; }
.logout-icon { display: none; width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

main.wrap { flex: 1; padding-block: 40px 64px; }   /* Logo-Kasten ragt nicht mehr unter die Leiste */

/* ---------- Typografie ---------- */
h1, h2, h3, h4 { color: var(--wine); line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 2.6rem; font-weight: 900; }
h2 { font-size: 1.5rem; font-weight: 900; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
.lead { font-size: 1.1rem; margin: -4px 0 24px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* ---------- Grundbausteine ---------- */
.card { background: var(--card); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card.narrow { max-width: 460px; margin: 30px auto; }
.card > :last-child { margin-bottom: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Aufklappbare Bereiche (Dropdowns) ---------- */
details > summary { list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
details > summary::-webkit-details-marker { display: none; }
details > summary:focus-visible { outline: 2px solid var(--wine); outline-offset: -2px; }
.chev {
  flex: 0 0 auto; width: 11px; height: 11px; margin: -5px 4px 0 4px;
  border-right: 3px solid var(--wine); border-bottom: 3px solid var(--wine);
  transform: rotate(45deg); transition: transform .2s ease, margin .2s ease;
}
details[open] > summary .chev { transform: rotate(-135deg); margin-top: 5px; }

/* Jedes Quartal ist ein Dropdown; seine Kopfzeile bleibt beim Scrollen unter der
   Kopfleiste stehen, bis das nächste Quartal sie ablöst. */
.quarter-section { margin: 20px 0; scroll-margin-top: calc(var(--header-h) + var(--mybar-full)); }
.quarter-head {
  position: sticky; top: calc(var(--header-h) + var(--mybar-h)); z-index: 20;
  transition: top .2s ease;
  display: flex; align-items: center; flex-wrap: nowrap; gap: 8px 14px;
  min-height: var(--quarter-h);
  margin: 0 -20px; padding: 10px 20px 8px;
  background: rgba(235, 235, 235, .96);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--wine);
}
.quarter-head .badge + .chev { margin-left: 4px; }
.quarter-head h2 + .chev { margin-left: auto; }
.quarter-body { padding: 14px 0 4px; }
.quarter-tools { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.quarter { margin: 0; font-size: 1.7rem; font-weight: 900; }
.quarter-months { font-size: 1rem; font-weight: 700; color: var(--muted); margin-left: 6px; }
.quarter-head .badge { font-size: .85rem; padding: 5px 10px 3px; margin-left: auto; white-space: nowrap; }
.quarter-head h2 { min-width: 0; }
.short { display: none; }
.badge-todo { background: #FFF4E5; color: #8A5300; }

.empty-state { text-align: center; color: var(--muted); padding: 48px 0; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Meldungen ---------- */
.flashes { margin-bottom: 20px; }
.flash { background: #fff; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 8px; border-left: 5px solid; }

/* Eigener Rückfrage-Dialog (statt System-Meldung) */
.confirm-dialog {
  border: 0; padding: 0; width: min(420px, calc(100% - 32px));
  border-top: 5px solid var(--red); box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  color: var(--text); font-family: var(--font);
}
.confirm-dialog::backdrop { background: rgba(40, 10, 15, .55); }
.confirm-dialog[open] { animation: toast-in .2s ease-out; }
.confirm-dialog form { padding: 20px 20px 16px; }
.confirm-title { margin: 0 0 6px; font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--wine); }
.confirm-text { margin: 0 0 18px; font-size: 1.05rem; line-height: 1.45; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.confirm-actions .btn { min-height: 44px; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
@media (max-width: 480px) {
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; }
}

/* Meldungen als schwebende Hinweise im sichtbaren Bereich */
.toasts {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(var(--header-h) + var(--mybar-h) + 12px);
  width: min(520px, calc(100% - 24px)); margin: 0;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer; margin: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  animation: toast-in .25s ease-out, toast-out .6s ease-in 2s forwards;
}
.flash-warning.toast { animation: toast-in .25s ease-out, toast-out .6s ease-in 5s forwards; }   /* Warnungen 5 s */
.toast-sticky { animation: toast-in .25s ease-out; }          /* Fehler bleiben stehen */
.toast-close {
  flex: 0 0 auto; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 1.4rem; line-height: 1; color: inherit; padding: 0 2px; margin-top: -2px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
  @keyframes toast-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes toast-out { to { opacity: 0; visibility: hidden; } }
}
.flash-success { border-color: var(--ok); }
.flash-error { border-color: var(--red); color: var(--red-hover); }
.flash-info { border-color: var(--wine); }
.flash-warning { border-color: #E69500; background: #FFF8EC; color: #7A4A00; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 700; line-height: 1.2;
  padding: 11px 20px 9px; border: 2px solid var(--line-strong); border-radius: 0;
  background: #fff; color: var(--text); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--wine); color: var(--wine); text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); color: #fff; }
.btn-wine { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-wine:hover { background: var(--wine-dark); border-color: var(--wine-dark); color: #fff; }
.btn-danger { border-color: var(--red); color: var(--red); background: #fff; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px 4px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 14px; color: var(--wine); }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px 8px;
  font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 0; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--wine); outline-offset: -1px; border-color: var(--wine); }
input.is-invalid { border-color: var(--red); background: #FDE8EA; }
input.is-invalid:focus { outline-color: var(--red); }
.field-error {
  display: flex; gap: 8px; align-items: flex-start; margin: -6px 0 14px; padding: 8px 10px 6px;
  background: #FDE8EA; border-left: 4px solid var(--red); color: #A00012; font-weight: 700; font-size: .92rem;
}
.field-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--red); color: #fff; font-size: .75rem; font-weight: 900; line-height: 1; }
/* Startseite nach der Anmeldung: Kachel je Dienstplan */
.plan-card + .plan-card { margin-top: 16px; }
.plan-teaser { position: relative; background: transparent; box-shadow: none; border: 2px dashed var(--line-strong); color: var(--muted); }
.plan-teaser h2 { margin: 0 0 4px; font-size: 1.25rem; color: var(--muted); }
.plan-teaser p { margin: 0; }
.teaser-badge {
  display: inline-block; margin-bottom: 8px; padding: 3px 9px 1px; background: var(--line-strong); color: #fff;
  font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
}

/* Eigene Aufklappliste (Namensauswahl) statt der System-Auswahl */
.picker-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.picker { position: relative; margin: 5px 0 16px; }
.picker-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px 8px;
  font: inherit; font-weight: 700; color: var(--text); text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 0;
}
.picker-btn.is-empty .picker-value { color: var(--muted); font-weight: 400; }
.picker-btn:focus-visible, .picker.is-open .picker-btn { outline: 2px solid var(--wine); outline-offset: -1px; border-color: var(--wine); }
.picker-btn.is-invalid { border-color: var(--red); background: #FDE8EA; }
.picker-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-chev { flex: none; width: 10px; height: 10px; border-right: 2.5px solid var(--wine); border-bottom: 2.5px solid var(--wine);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.picker.is-open .picker-chev { transform: rotate(-135deg) translate(-2px, -2px); }
.picker-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--wine);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18); max-height: min(60vh, 420px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.picker-list li {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px 6px; cursor: pointer;
  border-bottom: 1px solid var(--line); font-weight: 700; color: var(--text);
}
.picker-list li:last-child { border-bottom: 0; }
.picker-list li:hover, .picker-list li:focus { background: var(--panel); outline: none; }
.picker-list li[aria-selected="true"] { color: var(--wine); background: #F7EEEF; }
.picker-icon { flex: none; width: 26px; height: 26px; padding: 5px; border-radius: 50%; background: var(--panel); fill: var(--muted); }
.picker-list li[aria-selected="true"] .picker-icon { background: var(--wine); fill: #fff; }
.picker-list li > span:first-of-type { flex: 1; }
.picker-check { visibility: hidden; color: var(--wine); font-weight: 900; }
.picker-list li[aria-selected="true"] .picker-check { visibility: visible; }
.picker + .field-error { margin-top: -10px; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; color: var(--text); }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line); padding: 14px 16px; margin: 0 0 14px; }
legend { font-weight: 900; color: var(--wine); padding: 0 6px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .span-2 { grid-column: span 2; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 170px; margin: 0; }
.inline-form .w-small, .w-small { flex: 0 0 110px; width: 110px; }
.name-form input { flex: 1 1 140px; }

/* Maschinisten: kompakte Zeile zum Anlegen + Tabelle mit direkt bearbeitbaren Feldern */
.member-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.member-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--wine); padding: 10px 12px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.member-card.inactive { border-left-color: var(--line-strong); background: var(--panel); }
.member-card.inactive .member-names input { color: var(--muted); }
.member-add { background: var(--panel); border-left-color: var(--red); margin-bottom: 18px; }
.member-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.member-names input { margin: 0; height: 38px; padding: 7px 9px 5px; min-width: 0; }
.member-bar { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.member-since { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .8rem; white-space: nowrap; }
.member-since input { margin: 0; height: 38px; padding: 6px 8px 4px; width: auto; }
.member-since { font-weight: 700; color: var(--wine); }
.quarter-fields { display: inline-flex; gap: 6px; }
.quarter-fields select, .quarter-fields input { margin: 0; height: 38px; padding: 6px 8px 4px; width: auto; }
.quarter-fields select {
  -webkit-appearance: none; appearance: none; background-color: #fff; padding-right: 26px; min-width: 64px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23772E37'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.quarter-fields input { -moz-appearance: textfield; }
.quarter-fields input::-webkit-outer-spin-button, .quarter-fields input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.quarter-fields input { width: 5.2em; }
.status-quarter { margin: 0 0 18px; }
.status-quarter-label { display: block; font-weight: 700; font-size: .9rem; color: var(--wine); margin-bottom: 5px; }
.status-quarter .quarter-fields select, .status-quarter .quarter-fields input { height: 44px; font-size: 16px; }
.member-add-btn { white-space: nowrap; }
.member-actions { display: flex; gap: 6px; margin-left: auto; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-icon svg { display: none; }
.member-history {
  grid-column: 1 / -1; list-style: none; margin: 0; padding: 7px 0 0; border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.member-history li { display: inline-flex; align-items: center; gap: 6px; }
.member-history li + li::before { content: "→"; color: var(--line-strong); font-size: .8rem; }
.history-chip {
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; padding: 4px 9px 2px;
  border: 1px solid currentColor; background: #fff;
}
.history-chip.is-active { color: #2E7D32; }
.history-chip.is-inactive { color: var(--red); }
.history-chip:hover { background: var(--panel); }

/* Schalter aktiv/inaktiv */
.status-switch {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; min-height: 38px;
  background: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: var(--text);
}
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--line-strong); transition: background .15s; flex: none; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.status-switch.on .switch-track { background: #2E7D32; }
.status-switch.on .switch-knob { left: 21px; }
.status-switch .switch-label { min-width: 52px; text-align: left; }
.status-switch:not(.on) .switch-label { color: var(--muted); }
.status-dialog label { margin: 0 0 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-2 .card { margin-bottom: 0; }

/* ---------- Dienstkarten ---------- */
.service {
  padding: 0; margin-bottom: 10px; border-left: 5px solid var(--red);
  scroll-margin-top: calc(var(--header-h) + var(--mybar-full) + var(--quarter-h) + 12px);
}
.service.mine { border-left-color: var(--ok); }   /* gleiches Grün wie „Deine DLK-Dienste“ */
.service.past { opacity: .55; filter: grayscale(1); border-left-color: var(--line-strong); }
.service[open] { margin-bottom: 16px; }

/* Kompakte Dienstzeile (immer sichtbar) */
/* Dienstzeile: links das Datumsfeld, exakt so hoch wie die drei Textzeilen daneben */
.service-summary { display: flex; align-items: stretch; gap: 16px; padding: 12px 18px; }
.service-summary > .service-status, .service-summary > .chev { align-self: center; }
.service-summary:hover h3 { color: var(--red); }
.service-date {
  flex: 0 0 56px; text-align: center; background: var(--wine); color: #fff;
  padding: 4px 0 2px; line-height: 1.1;
  display: flex; flex-direction: column; justify-content: center;
}
.service.past .service-date { background: var(--muted); }
.service-date .day { display: block; font-size: 1.5rem; font-weight: 900; }
.service-date .wd { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.service-info { flex: 1; min-width: 0; }
.service-info h3 { margin: 0; font-size: 1.1rem; font-weight: 900; transition: color .15s; }
.service-info .meta { margin: 0; color: var(--muted); font-size: .95rem; }
/* jede der drei Zeilen bleibt einzeilig, damit das Datumsfeld immer gleich hoch ist */
.service-info h3, .service-info .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-info .meta { line-height: 1.4; }
.thema-label { font-weight: 700; color: var(--wine); }
.service-status { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip { font-size: .8rem; font-weight: 700; padding: 4px 9px 2px; white-space: nowrap; background: var(--panel); color: var(--muted); }
.chip-mine { background: var(--ok); color: #fff; }
.chip-full { background: var(--ok-bg); color: var(--ok); }

/* Name/Info in der kompakten Dienstzeile */
.service-note {
  margin: 3px 0 0; font-size: .88rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Thema: zugeklappt eine Zeile mit „…“, aufgeklappt vollständig – gleiche Darstellung, keine Farbfläche */
.service[open] .service-note { white-space: pre-line; overflow: visible; text-overflow: clip; }

/* ---------- Sonstige Dienste ---------- */
.section-title { margin: 28px 0 12px; font-size: 1.5rem; }
.section-title .small { font-weight: 400; margin-left: 6px; }

/* Admin-Formular: Sonstiger Dienst blendet die Anzahl Maschinisten aus */
.type-switch { background: var(--panel); padding: 10px 14px 8px; margin-bottom: 14px; border-left: 4px solid var(--wine); }
.type-switch label.check { align-items: flex-start; }
.type-switch input { margin-top: 4px; }
.service-form:has(#info_only:checked) .slots-fieldset { display: none; }
.slot-count input { max-width: 140px; }
.service-count {
  font-weight: 900; font-size: .95rem; white-space: nowrap; color: var(--wine);
  border: 2px solid var(--line); padding: 3px 9px 1px;
}
.service-count.full { border-color: var(--ok); color: var(--ok); }

.service-body { border-top: 1px solid var(--line); }
.slot-group { padding: 14px 24px; }
.slot-group + .slot-group { border-left: 1px solid var(--line); }
.slot-group h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.slot-group h4 .count { color: var(--muted); letter-spacing: 0; }

/* Eingetragene Personen als Pillen – wie die Personen-Anzeige in der Kopfzeile */
ul.names { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.person-pill {
  display: inline-flex; align-items: stretch; max-width: 100%; overflow: hidden;
  border-radius: 999px; background: #F5E6E8; color: var(--wine);
  font-weight: 700; font-size: .92rem; line-height: 1.2;
}
/* linkes Feld: voll gefärbt, bündig am Rand */
.pill-badge {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 2.6em; padding: 1px 0 0 3px;            /* feste Breite: GF und MA exakt gleich groß */
  background: var(--wine); color: #fff;
  font-size: .78em; font-weight: 900; font-style: normal; letter-spacing: .04em;
}
.person-pill-name { padding: 5px 11px 3px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* man selbst: Rahmen in der Farbe der Pille */
.person-pill-me { box-shadow: inset 0 0 0 2px var(--wine); }
/* Gruppenführer: blau */
.person-pill-gf { background: var(--gf-bg); color: var(--gf); }
.person-pill-gf .pill-badge { background: var(--gf); }
.person-pill-gf.person-pill-me { box-shadow: inset 0 0 0 2px var(--gf); }
/* freie Plätze: nur Umriss, „frei“ kursiv */
.person-pill-free { background: transparent; color: var(--muted); font-weight: 400; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.person-pill-free .pill-badge { background: #D9D9D9; color: #fff; }
.person-pill-free .person-pill-name { font-style: italic; min-width: 46px; text-align: center; padding-right: 13px; overflow: visible; }
.person-pill-free.person-pill-gf { color: var(--gf); box-shadow: inset 0 0 0 1.5px var(--gf); }
.person-pill-free.person-pill-gf .pill-badge { background: var(--gf); }
.btn-gf { background: var(--gf); border-color: var(--gf); color: #fff; }
.btn-gf:hover { background: #164B86; border-color: #164B86; color: #fff; }


.service-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--panel); border-top: 1px solid var(--line);
}
.service-actions .status { font-weight: 700; color: var(--wine); }
.service-actions .status.ok::before { content: "✓ "; color: var(--ok); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 8px 1px; background: var(--panel); color: var(--muted); }
.badge-full, .badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-empty, .badge-warn { background: #FDE8EA; color: var(--red); }
.badge-super { background: var(--wine); color: #fff; vertical-align: middle; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 0; margin-bottom: 28px; background: #fff; box-shadow: var(--shadow); overflow-x: auto; }
.tabs a { padding: 14px 20px 11px; color: var(--text); font-weight: 700; white-space: nowrap; text-decoration: none; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--wine); text-decoration: none; }
.tabs a.active { color: var(--wine); border-bottom-color: var(--red); }

.table-wrap { overflow-x: auto; background: var(--card); box-shadow: var(--shadow); margin-bottom: 16px; }
.card .table-wrap { box-shadow: none; margin-inline: -24px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 11px 14px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { background: var(--panel); color: var(--wine); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
table.list td.right, table.list th.right { text-align: right; }
table.list td.num, table.list th.num { text-align: center; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.past { opacity: .6; }
table.list tr.warn td:first-child { box-shadow: inset 4px 0 0 var(--red); }


.year-switch { display: flex; gap: 6px; flex-wrap: wrap; }
/* Auswertung: Kapitel mit Überschrift und gleich gestalteten Export-Buttons */
.eval-section { margin-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 6px; }
.section-head h2 { margin: 0; }
.export-buttons { display: flex; gap: 10px; }
.export-buttons .btn { min-width: 150px; text-align: center; }
.year-switch a { padding: 6px 14px 4px; border: 2px solid var(--line-strong); color: var(--text); font-weight: 700; background: #fff; }
.year-switch a.active { background: var(--wine); border-color: var(--wine); color: #fff; }
.year-switch a:hover { text-decoration: none; border-color: var(--wine); }

.quarter-matrix td.num { font-weight: 700; white-space: nowrap; }
.q-ok { color: var(--ok); background: var(--ok-bg); }
.q-multi { color: #7A4A00; background: #FFF4E5; }
.q-missing { color: var(--red); background: #FDE8EA; }
.q-dates { display: block; font-weight: 400; font-size: .8rem; }


.danger-zone { border-top: 4px solid var(--red); }

/* ---------- Fußzeile ---------- */
.footer { background: var(--wine); color: #fff; font-size: .9rem; }
.footer .wrap { padding-block: 18px 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: #fff; }
/* Protokoll */
.log-filter select { margin: 0; width: auto; min-width: 200px; }
.log-action { font-weight: 700; white-space: nowrap; }
.log-in { color: var(--ok); }
.log-out { color: var(--red); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0; flex-wrap: wrap; }
.footer-version { opacity: .75; font-weight: 400; white-space: nowrap; }
.footer-version::before { content: "·"; margin: 0 .45em; }
.footer-links { display: inline-flex; gap: 18px; flex-wrap: wrap; }

/* Impressum */
.legal { max-width: 760px; }
.legal h2 { margin: 26px 0 6px; font-size: 1.2rem; }
.legal p { margin: 0 0 10px; line-height: 1.55; }
.legal .lines { white-space: pre-line; }
.legal-list { margin: 0 0 10px; padding-left: 22px; line-height: 1.55; }
.legal .placeholder { background: var(--panel); border-left: 4px solid var(--line-strong); padding: 10px 14px; color: var(--muted); }

/* ---------- Mobil ---------- */
/* ---------- Leiste „Deine DLK-Dienste“ beim Scrollen ---------- */
.my-bar {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 45;
  background: #fff; border-bottom: 2px solid var(--wine);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  transform: translateY(-120%); visibility: hidden;
  transition: transform .2s ease, visibility .2s;
}
body.show-mybar { --mybar-h: var(--mybar-full); }
body.show-mybar .my-bar { transform: none; visibility: visible; }
.my-bar-inner {
  display: flex; align-items: center; gap: 6px; height: var(--mybar-full);
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.my-bar-inner::-webkit-scrollbar { display: none; }
.my-bar-label { font-size: .75rem; font-weight: 900; color: var(--wine); text-transform: uppercase; letter-spacing: .06em; margin-right: 6px; }
.my-chip {
  flex: 0 0 auto; font-size: .85rem; font-weight: 700; padding: 5px 10px 3px;
  background: var(--panel); color: var(--text); text-decoration: none;
  border-left: 3px solid var(--line-strong);
}
.my-chip:hover { text-decoration: none; color: var(--text); background: #e6e6e6; }
.my-chip b { color: var(--wine); margin-right: 5px; }
.my-chip-ok { background: var(--ok-bg); border-left-color: var(--ok); }
.my-chip-multi { background: #FFF4E5; border-left-color: #E69500; color: #7A4A00; }
.my-chip-missing { border-left-color: var(--red); color: var(--red); }
.my-chip-todo { color: #8A5300; font-weight: 400; }

/* ---------- Deine DLK-Dienste ---------- */
.my-plan { border-top: 4px solid var(--wine); padding: 18px 24px; margin-bottom: 44px; }
.my-plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.my-plan-head h2 { margin: 0; font-size: 1.4rem; }
.my-plan-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.my-q { background: var(--panel); padding: 10px 12px 8px; border-left: 4px solid var(--line-strong); }
.my-q-ok { border-left-color: var(--ok); }
.my-q-multi { border-left-color: #E69500; background: #FFF8EC; }
.my-q-missing { border-left-color: var(--red); }
.my-q-other { border-left-color: var(--wine); }
.my-q.is-past, .my-date.is-past, .my-chip.is-past { opacity: .55; filter: grayscale(1); }   /* vergangene Dienste ausgegraut */
/* Vergangenes Quartal: komplett ausgegraut, bleibt aber aufklappbar */
.quarter-section.is-past > .quarter-head,
.quarter-section.is-past > .quarter-body { opacity: .55; filter: grayscale(1); }
.quarter-section.is-past .service.past { opacity: 1; filter: none; }   /* nicht doppelt abschwächen */
.quarter-section.is-past .quarter-head .badge, .my-chip.is-past { background: var(--panel); color: var(--muted); border-left-color: var(--line-strong); }
.my-infos { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.my-infos-title { margin: 0 0 8px; font-size: 1.2rem; font-weight: 900; color: var(--wine); line-height: 1.2; }
.my-q-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.2rem; font-weight: 900; color: var(--wine); line-height: 1.2; margin-bottom: 6px; }
.my-q-label .badge { font-size: .78rem; }
.my-date { display: block; color: var(--text); padding: 6px 0 4px; }
.my-date + .my-date { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.my-q { display: flex; flex-direction: column; }
/* Buttons stehen in allen Kacheln unten bündig */
.my-q > .my-date:last-of-type { flex: 1; display: flex; flex-direction: column; }
.my-q > .my-date:last-of-type > .my-date-crew,
.my-q > .my-date:last-of-type > .my-q-note { margin-bottom: auto; }
.my-q .my-q-note { display: block; }
.my-date-when { display: block; }
.my-date-when strong { color: var(--wine); }
.my-date-topic { display: block; font-size: .92rem; font-weight: 700; color: var(--wine); margin-top: 1px; }
.my-date-place { font-weight: 400; color: var(--muted); }
.my-date-info-text { display: block; font-size: .88rem; color: var(--text); margin-top: 2px; white-space: pre-line; }
.my-date-crew { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; font-size: .9rem; color: var(--muted); }
.my-date-crew .person-pill { font-size: .8rem; }
.my-date-crew .person-pill-name { padding: 3px 9px 1px 6px; }
.my-q-note { margin: 2px 0 0; font-size: .9rem; color: var(--muted); }
.my-q-multi .my-q-note { color: #7A4A00; font-weight: 700; }
.my-q-missing .my-q-note { color: var(--red); font-weight: 700; }
.my-q-btn { display: block; text-align: center; margin-top: 10px; padding: 9px 14px 7px; font-size: .9rem; min-height: 40px; }
.my-q-btn:hover { color: #fff; }

/* ---------- „Deine DLK-Dienste“ kompakt: ein Quartal = eine Zeile ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.my-plan-head { margin-bottom: 8px; }
.plan-compact { grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 6px 10px; align-items: start; }
.plan-compact > li { min-width: 0; }      /* lange Texte kürzen statt die Zeile zu verbreitern */
.plan-compact .my-q {
  flex-direction: row; align-items: stretch; gap: 10px; padding: 6px 8px 6px 6px; border-left-width: 4px;
  height: 80px; overflow: hidden;                 /* alle Zeilen exakt gleich hoch */
}
.plan-q {
  flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; color: var(--wine); line-height: 1.05;
}
.plan-q b { font-size: 1.02rem; font-weight: 900; }
.plan-q span { font-size: .66rem; font-weight: 700; opacity: .8; }
.my-q-other .plan-q b { font-size: .82rem; }
.my-q-ok .plan-q { background: var(--ok); color: #fff; }
.my-q-multi .plan-q { background: #E69500; color: #fff; }
.my-q-missing .plan-q { background: var(--red); color: #fff; }
.my-q-other .plan-q { background: var(--wine); color: #fff; }
.plan-compact .plan-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0; margin: 0; border: 0; }
.plan-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.plan-compact .my-date-when { font-size: .88rem; }
.plan-title { font-weight: 700; color: var(--wine); font-size: .84rem; }
.plan-title .my-date-place { font-weight: 400; color: var(--muted); }
.plan-compact .my-date-crew { display: flex; flex-wrap: nowrap; gap: 3px; margin: 0; }
.plan-compact .my-date-crew .person-pill { font-size: .76rem; flex: 0 0 auto; }
.plan-compact .my-date-crew .person-pill-name { padding: 2px 8px 1px 5px; }
.plan-compact .my-date-crew .person-pill-free .person-pill-name { min-width: 34px; padding-right: 9px; }
.plan-compact .my-date-info-text { font-size: .76rem; margin: 0; }
/* DLK-Kacheln: 4 Zeilen (Termin, GF, Maschinisten, Thema) – alle gleich hoch */
.plan-compact.plan-dlk .my-q { height: 118px; }
/* Besatzung (GF + Maschinisten) etwas abgesetzt von Datum und Thema */
.plan-compact.plan-dlk .my-date-gf { margin-top: 5px; }
.plan-compact.plan-dlk .my-date-crew:not(.my-date-gf) { margin-bottom: 5px; }
.plan-compact .multi-mark { color: #B36B00; margin-right: 2px; }
.plan-compact .my-q-note { margin: 0; font-size: .84rem; }
.plan-compact .my-q-multi .my-q-note { color: #7A4A00; font-weight: 700; font-size: .78rem; }
/* Button-Spalte: gleiche Breite in jeder Zeile, Button immer rechtsbündig an derselben Stelle */
.plan-action { flex: 0 0 86px; display: flex; align-items: center; justify-content: flex-end; }
.plan-compact .my-q-btn {
  width: 86px; min-width: 0; min-height: 34px; margin: 0; padding: 8px 6px 5px;
  font-size: .8rem; text-align: center; display: inline-block;
}
.my-infos { margin-top: 10px; padding-top: 8px; }
.my-infos-title { font-size: 1rem; margin-bottom: 6px; }

/* ---------- Smartphone ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }

  /* Kopfzeile scrollt mit, damit der Logo-Kasten keinen Inhalt verdeckt */
  :root { --header-h: 56px; --quarter-h: 52px; --mybar-full: 40px; }
  .my-bar-label { display: none; }
  .my-bar-inner { gap: 5px; }
  .my-chip { font-size: .8rem; padding: 4px 8px 2px; }
  .brand { left: 12px; width: 136px; height: var(--header-h); padding: 4px 8px 1.125px; gap: 2px; }
  .brand-name { font-size: .56rem; padding: 2.875px 0 0; }
  .topbar nav { gap: 16px; flex-wrap: nowrap; }
  .topbar nav a, .topbar nav .link { font-size: .9rem; padding: 12px 0 9px; } /* große Tippfläche */
  .hide-mobile { display: none; }
  .topbar nav { min-width: 0; }
  .topbar nav a.current-user { padding: 6px 10px 4px; font-size: .85rem; }
  .beta-badge { font-size: .62rem; padding: 2px 6px 0; border-width: 1.5px; letter-spacing: .06em; }
  .current-user-name { max-width: 150px; }
  /* Abmelden auf dem Handy als Symbol, damit der Name Platz hat */
  .topbar nav .logout { display: inline-flex; align-items: center; padding: 8px 2px; }
  .logout-icon { display: block; }
  .logout-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar nav { gap: 10px; }
  .topbar-inner { padding-left: 156px; }
  .welcome { margin-bottom: 12px; }
  .welcome-title { font-size: 2.1rem; }

  .wrap { padding-inline: 12px; }
  main.wrap { padding-top: 22px; padding-bottom: 40px; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  .lead { font-size: .95rem; margin-bottom: 14px; }
  .page-head { align-items: center; margin-top: 8px; }
  .card { padding: 16px 14px; margin-bottom: 14px; }
  .card.narrow { margin-top: 12px; }
  .card .table-wrap { margin-inline: -14px; }
  .flash { padding: 10px 12px; }

  /* Buttons und Formulare: mindestens 44px hoch, 16px Schrift (kein Zoom unter iOS) */
  .btn { min-height: 44px; padding: 12px 16px 9px; }
  .btn-small { min-height: 38px; padding: 9px 12px 6px; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .form-grid, .grid-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .inline-form input, .inline-form select { flex-basis: 100%; }

  /* Deine DLK-Dienste */
  .my-plan { padding: 14px 12px 12px; margin-bottom: 32px; }
  .my-plan-head h2 { font-size: 1.25rem; }
  .my-plan-list { grid-template-columns: 1fr; gap: 8px; }
  .my-date { padding: 8px 0 6px; }

  /* Quartale */
  .quarter-head { margin: 0 -12px; padding: 8px 12px 6px; }
  .quarter-section { margin: 14px 0; }
  .quarter-body { padding-top: 10px; }
  .quarter { font-size: 1.2rem; line-height: 1.15; }
  .quarter-months { display: block; margin: 1px 0 0; font-size: .8rem; }
  .quarter-head .badge { font-size: .8rem; padding: 4px 8px 2px; }
  .long { display: none; }
  .short { display: inline; }

  /* Dienstkarten kompakt */
  .card.service { padding: 0; }
  .service-summary { padding: 10px 10px 10px 12px; gap: 10px; min-height: 64px; }
  .service-date { flex-basis: 48px; padding: 5px 0 3px; }
  .service-date .day { font-size: 1.3rem; }
  .service-date .wd { font-size: .65rem; }
  .service-info h3 { font-size: .98rem; }
  .service-info .meta { font-size: .85rem; }
  .service-status { flex-direction: column; align-items: flex-end; gap: 4px; }
  .chip { font-size: .75rem; padding: 3px 7px 1px; }
  .service-count { font-size: .8rem; padding: 2px 6px 0; border-width: 1px; }
  .service-note { font-size: .8rem; }
  .section-title { font-size: 1.25rem; margin-top: 20px; }
  .slot-group { padding: 10px 12px; }
  .slot-group + .slot-group { border-left: 0; border-top: 1px solid var(--line); }
  .slot-group h4 { margin-bottom: 4px; }
  .person-pill { font-size: .88rem; }

  .service-actions { padding: 10px 12px 12px; gap: 8px; }
  .service-actions > span { flex: 1 1 100%; font-size: .9rem; }
  .service-actions form { flex: 1 1 100%; }
  .service-actions .btn { width: 100%; }

  /* Admin */
  .tabs { margin-bottom: 18px; }
  .tabs a { padding: 13px 14px 10px; }
        table.list th, table.list td { padding: 9px 10px 7px; }
  .year-switch a { padding: 9px 14px 6px; }

  /* Maschinisten auf dem Handy */
  .member-list { gap: 8px; }
  .member-card { grid-template-columns: 1fr; gap: 6px; padding: 8px 8px 8px 10px; }
  .member-names { gap: 6px; }
  .member-names input, .member-since input, .member-since select { min-height: 0; height: 42px; padding: 6px 8px 4px; }
  .member-add .member-bar { flex-wrap: wrap; }
  .member-add .member-since { flex: 1 1 100%; justify-content: space-between; }
  .member-add .member-since .quarter-fields { flex: 1; }
  .member-add .member-since .quarter-fields > * { flex: 1; }
  .member-add .member-add-btn { flex: 1 1 100%; }
  .member-actions .btn { min-height: 40px; padding: 8px 12px 6px; }
  .btn-icon { padding-inline: 11px; }
  .btn-icon svg { display: block; }
  .btn-icon-text { display: none; }
  .member-history { padding-top: 6px; gap: 5px; }
  .history-chip { font-size: .74rem; padding: 5px 8px 3px; }

  /* Protokoll am Handy: 3 kompakte Zeilen je Eintrag */
  body.admin table.list.log-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 9px 12px 8px; }
  body.admin table.list.log-table td::before { display: none !important; }
  body.admin table.list.log-table td { padding: 0; }
  body.admin table.list.log-table td:nth-child(3) { order: 1; }
  body.admin table.list.log-table td:nth-child(2) { order: 2; }
  body.admin table.list.log-table td:nth-child(4) { order: 3; flex: 1 1 100%; }
  body.admin table.list.log-table td:nth-child(1), body.admin table.list.log-table td:nth-child(5) { order: 4; font-size: .8rem; color: var(--muted); }
  body.admin table.list.log-table td:nth-child(5)::before { content: "· " !important; display: inline !important; margin: 0; font: inherit; letter-spacing: 0; text-transform: none; color: inherit; }
  .log-filter { width: 100%; }
  .log-filter select { width: 100%; }

  .footer .wrap { padding-block: 14px calc(12px + env(safe-area-inset-bottom, 0px)); }

  /* ---------- Admin auf dem Handy: nichts scrollt seitlich ---------- */
  body.admin main.wrap { overflow-x: clip; }
  body.admin .tabs { flex-wrap: wrap; overflow: visible; }
  body.admin .tabs a { flex: 1 1 auto; text-align: center; padding: 11px 10px 8px; }
  body.admin .page-head .actions { width: 100%; }
  body.admin .page-head .actions .btn { flex: 1 1 auto; text-align: center; }
  body.admin .quarter-tools .btn { width: 100%; }
  body.admin .export-buttons { width: 100%; }
  body.admin .export-buttons .btn { flex: 1 1 0; min-width: 0; }

  /* Tabellen werden zu Karten: eine Zeile = eine Karte, Felder untereinander */
  body.admin .table-wrap { overflow: visible; }
  body.admin .card .table-wrap { margin-inline: 0; }
  body.admin table.list, body.admin table.list tbody,
  body.admin table.list tr, body.admin table.list td { display: block; width: auto; }
  body.admin table.list thead { display: none; }
  body.admin table.list tr { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
  body.admin table.list tr:last-child { border-bottom: 0; }
  body.admin table.list td { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  body.admin table.list td[data-label]:not([data-label=""])::before {
    content: attr(data-label); display: block; margin-top: 6px;
    font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--wine);
  }
  body.admin table.list td.right { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; text-align: left; }
  body.admin table.list td.right::before { display: none !important; }
  body.admin table.list td.right .btn, body.admin table.list td.right form { flex: 1 1 auto; }
  body.admin table.list td.right form .btn { width: 100%; }
  body.admin table.list tr.warn td:first-child { box-shadow: none; }
  body.admin table.list tr.warn { box-shadow: inset 4px 0 0 var(--red); }

  /* Dienst-Tabellen: Datum und Zeit zusammen in der ersten Zeile, ohne Beschriftung */
  body.admin table.svc-table td:nth-child(1), body.admin table.svc-table td:nth-child(2) {
    display: inline-block; font-weight: 700; color: var(--wine); margin-right: 10px;
  }
  body.admin table.svc-table td:nth-child(1)::before, body.admin table.svc-table td:nth-child(2)::before,
  body.admin table.svc-table td:nth-child(3)::before { display: none !important; }

  /* Quartalsübersicht bleibt eine Matrix – kompakt, damit nichts seitlich scrollt */
  body.admin table.quarter-matrix { display: table; width: 100%; table-layout: fixed; }
  body.admin table.quarter-matrix thead { display: table-header-group; }
  body.admin table.quarter-matrix tbody { display: table-row-group; }
  body.admin table.quarter-matrix tr { display: table-row; padding: 0; }
  body.admin table.quarter-matrix th, body.admin table.quarter-matrix td {
    display: table-cell; padding: 7px 3px 5px; font-size: .8rem; border-bottom: 1px solid var(--line);
  }
  body.admin table.quarter-matrix th:first-child, body.admin table.quarter-matrix td:first-child { width: 34%; padding-left: 8px; }
  body.admin table.quarter-matrix td:first-child { overflow-wrap: anywhere; }
  body.admin table.quarter-matrix td::before { display: none !important; }
  body.admin table.quarter-matrix td.num { text-align: center; white-space: normal; }
  body.admin .quarter-matrix .q-dates { display: none; }      /* Daten stehen im Tooltip bzw. im PDF */
}

@media (max-width: 360px) {
  .brand { width: 128px; }
  .topbar-inner { padding-left: 146px; }
  .current-user-name { max-width: 96px; }
  .topbar nav { gap: 12px; }
}

[hidden] { display: none !important; }
