/*
 * Schichtplan – Design „Arbeitsbereich v2“ (Kurz Bauernhof).
 * Flach: 1px-Linien, keine Verläufe, keine Schatten, Ecken 0 (nur Chips 2px).
 * Rot sparsam: Hauptknopf, Links, Fokus, Markierung der aktiven Seite.
 * Keine externen Ressourcen: Schriften liegen unter app/assets/fonts
 * (SIL Open Font License, siehe LICENSE-*.txt).
 */

@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/roboto-condensed-latin-400-normal-712b47c1.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/roboto-condensed-latin-ext-400-normal-da0223c1.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/roboto-condensed-latin-500-normal-66eeefb3.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/roboto-condensed-latin-ext-500-normal-0550c05d.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/roboto-condensed-latin-600-normal-5ebd018f.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/roboto-condensed-latin-ext-600-normal-cdd69771.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/roboto-condensed-latin-700-normal-dfb993f6.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/roboto-condensed-latin-ext-700-normal-1221b3f2.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Delius"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/delius-latin-400-normal-eb37a8f8.woff2") format("woff2"); }

/* Farben: hell als Grundeinstellung, dunkel nach Systemeinstellung,
   data-theme="light"/"dark" am <html> überschreibt beides. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f4f4f4;
  --surface: #ffffff;
  --surface2: #fafafa;
  --raised: #f4f4f4;
  --border: #dcdcdc;
  --border-strong: #c4c4c4;
  --text: #3c3c3b;
  --text2: #555554;
  --muted: #6b6b6a;
  --accent: #c0181d;
  --accent-hover: #9e1317;
  --on-accent: #ffffff;
  --link: #c0181d;
  --brand-soft: #ffffff;
  --soft: #f0f4e3;
  --soft-border: #dbe5bf;
  --soft-text: #4a6618;
  --warn-bg: #fbf0d9;
  --warn-text: #7a4f00;
  --red: #c0181d;
  --reihe-0: #c0181d;
  --reihe-1: #2f6db5;
  --logo-bg: transparent;
  --sidebar: 248px;
  --font-body: "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-title: Delius, "Roboto Condensed", sans-serif;
  /* Flächen mit weißer Schrift (Abwesenheitsbalken): in beiden Modi gleich,
     damit der Kontrast reicht */
  --bar-vacation: #2f6db5;
  --bar-sick: #c0181d;
  --bar-other: #5f5f5e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1b1a; --side: #232322; --surface: #262625; --surface2: #2c2c2b; --raised: #2e2e2d;
  --border: #3a3a39; --border-strong: #4b4b4a;
  --text: #f2f2f0; --text2: #d0d0cc; --muted: #a5a5a0;
  --accent: #d43b40; --accent-hover: #e0504f; --on-accent: #ffffff; --link: #f2898b;
  --brand-soft: #2e2e2d; --soft: #1c2014; --soft-border: #343c22; --soft-text: #bcd27a;
  --warn-bg: #302b20; --warn-text: #f2d493; --red: #f07a7c;
  --reihe-0: #e0504f; --reihe-1: #3f87d8;
  --logo-bg: #fbfaf6;
}

@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1b1a; --side: #232322; --surface: #262625; --surface2: #2c2c2b; --raised: #2e2e2d;
    --border: #3a3a39; --border-strong: #4b4b4a;
    --text: #f2f2f0; --text2: #d0d0cc; --muted: #a5a5a0;
    --accent: #d43b40; --accent-hover: #e0504f; --on-accent: #ffffff; --link: #f2898b;
    --brand-soft: #2e2e2d; --soft: #1c2014; --soft-border: #343c22; --soft-text: #bcd27a;
    --warn-bg: #302b20; --warn-text: #f2d493; --red: #f07a7c;
    --reihe-0: #e0504f; --reihe-1: #3f87d8;
    --logo-bg: #fbfaf6;
  }
}

/* Grundlagen */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16.5px; line-height: 1.55; }
a { color: var(--link); text-underline-offset: 4px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { color: var(--on-accent); background: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 400; text-wrap: balance; }
h1 { font-family: var(--font-title); font-size: clamp(1.9rem, 3vw, 2.25rem); color: var(--accent); }
h2 { font-family: var(--font-title); font-size: 1.5rem; color: var(--text); }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
td, th, .num, .avail__time, .stat__value, .planshift__count { font-variant-numeric: tabular-nums; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.label { font-weight: 600; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }

.skiplink { position: fixed; top: 1rem; left: 1rem; z-index: 20; padding: .75rem 1rem; color: var(--on-accent); background: var(--accent); font-weight: 700; transform: translateY(-200%); }
.skiplink:focus { transform: none; color: var(--on-accent); }

/* Seitenleiste (angemeldet) bzw. schlichter Kopf (Anmeldung) */
.sidebar { display: flex; flex-direction: column; padding: 20px 16px 16px; background: var(--side); border-right: 1px solid var(--border); }
.is-signed-in .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: var(--sidebar); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; color: var(--muted); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand__logo { display: block; flex-shrink: 0; padding: 3px; background: var(--logo-bg); }
.brand__logo img { display: block; width: 64px; height: 64px; }
.brand__text { font-size: 13px; line-height: 1.35; }
.brand__text strong { display: block; color: var(--text); font-size: 15px; }
.sidebar .menutoggle { display: none; }
.sidebar__menu { display: flex; flex-direction: column; flex: 1 1 auto; }
.navlabel { margin: 28px 0 10px 12px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.mainnav { display: flex; flex-direction: column; gap: 2px; }
.mainnav__link { display: flex; align-items: center; min-height: 44px; padding: 8px 12px 8px 25px; color: var(--text2); font-size: 16px; text-decoration: none; }
.mainnav__link:hover { color: var(--text); background: var(--surface); }
.mainnav__link[aria-current="page"] { color: var(--link); background: var(--brand-soft); font-weight: 700; box-shadow: inset 4px 0 0 var(--accent); }
.account { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 24px; }
.account__who { display: flex; flex-direction: column; padding: 14px 6px 0; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.account__who strong { color: var(--text); }
.account__who span { color: var(--muted); font-size: 13px; }
.account form { margin: 0; }
.account .btn { width: 100%; }

/* Seite */
.page { max-width: 1400px; min-width: 0; min-height: calc(100vh - 60px); padding: 40px 40px 56px; display: flex; flex-direction: column; gap: 24px; }
.page:focus { outline: none; }
.page > * { min-width: 0; }
.is-signed-in .page, .is-signed-in .footer { margin-left: var(--sidebar); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; padding: 1rem 40px; color: var(--muted); border-top: 1px solid var(--border); font-size: 12.5px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.pagehead h1 { font-size: 2.5rem; line-height: 1.15; }
.pagehead__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; background: var(--soft); color: var(--soft-text); border: 1px solid var(--soft-border); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; }

.card { background: var(--surface); border: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
a.card { color: var(--text); text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.card--flush { padding: 0; overflow: hidden; }
.cardhead { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cardbody { margin: 16px 20px; }
.columns { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.columns > .card { flex: 1 1 420px; min-width: 0; }
.sectionhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 0; background: none; border: 0; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); }
.stat .eyebrow { color: var(--text2); font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.stat__value { font-size: 1.5rem; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; }
.stat--wide { grid-column: 1 / -1; }
.stat__value--kpi { font-size: 40px; letter-spacing: -.04em; }

/* Meldungen */
.flash { margin: 0; padding: 14px 18px; color: var(--text2); background: var(--soft); border: 1px solid var(--soft-border); border-left: 4px solid var(--soft-text); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash--alert { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-bg); border-left-color: var(--red); }
.flash--warn { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-bg); border-left-color: var(--warn-text); }
.empty { margin: 0; padding: 14px 16px; background: var(--surface2); border: 1px dashed var(--border); color: var(--muted); }
.hint { margin: 0; font-size: 13.5px; color: var(--muted); }

/* Knöpfe: .btn leise, .btn--primary rot */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 0; border: 1px solid var(--border-strong); background: transparent; color: var(--text2); font: inherit; font-size: 14px; font-weight: 400; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--raised); color: var(--text); }
.btn--primary { padding: 0 20px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--small { padding: 0 12px; font-size: 13.5px; }
.btn--primary.btn--small { font-size: 13.5px; }
.btn--icon { width: 44px; padding: 0; }
.btn--danger { align-self: flex-start; border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: var(--warn-bg); color: var(--red); }
form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Umschalter (Plan, Art der Abwesenheit): waagerecht, aktive Wahl mit 3px Strich unten */
.segmented { display: inline-flex; flex-wrap: wrap; align-self: flex-start; padding: 3px; gap: 2px; background: var(--raised); border: 1px solid var(--border); border-radius: 2px; }
.segmented__item { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 2px; color: var(--text2); text-decoration: none; }
.segmented__item:hover { color: var(--text); background: var(--surface); }
.segmented__item[aria-current="page"], .segmented__input:checked + .segmented__item { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
.segmented--choice { align-self: flex-start; }
.segmented__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented__input:focus-visible + .segmented__item { outline: 3px solid var(--accent); outline-offset: 3px; }
.segmented--choice .segmented__item { cursor: pointer; }

/* Tabellen */
/* relative: sonst ragen absolut gesetzte .sr-only-Texte aus dem Scrollbereich
   und verbreitern die ganze Seite */
.tablewrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table thead th { padding-top: 10px; padding-bottom: 10px; color: var(--text2); background: var(--raised); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.table td { color: var(--text2); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface2); }
.table .right, .table .num { text-align: right; }
.table tfoot th, .table tfoot td, .table tr.is-sum > * { background: var(--soft); color: var(--text); font-weight: 700; border-top: 2px solid var(--soft-text); }
tr.is-inactive td, tr.is-muted td, .table td.muted { color: var(--muted); }

/* Chips */
.badge, .reason, .kind { display: inline-block; padding: 4px 12px; border-radius: 2px; font-size: 13px; font-weight: 600; line-height: 1.3; border: 1px solid transparent; }
.badge:not([class*="badge--"]) { background: var(--raised); color: var(--text2); border-color: var(--border); }
.badge--ok { background: var(--soft); color: var(--soft-text); border-color: var(--soft-border); }
.badge--warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-text); }
.badge--danger { background: var(--warn-bg); color: var(--red); border-color: var(--red); }
.reason { padding: 2px 8px; font-size: 12.5px; font-weight: 500; background: var(--surface2); color: var(--muted); border-color: var(--border); }
.reason--warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-bg); }
.reason--block { background: var(--raised); color: var(--text2); border-color: var(--border-strong); }
.reason--conflict { background: var(--warn-bg); color: var(--red); border-color: var(--red); font-weight: 700; }

.level { display: inline-flex; width: 24px; height: 24px; margin-right: 2px; border-radius: 2px; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; border: 1px solid transparent; }
.level--a { background: var(--soft-text); color: var(--surface); }
.level--b { background: var(--soft); color: var(--soft-text); border-color: var(--soft-border); }
.level--c { background: var(--raised); color: var(--text2); border-color: var(--border-strong); }

/* Formulare */
.form { gap: 18px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 24px; }
.formgrid--dates { grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); }
.formgrid--times { grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); align-items: start; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .fieldset legend { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]), .field select, .field textarea,
.inlineform input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]), .inlineform select, .filterform input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]), .filterform select {
  min-height: 44px; padding: 8px 12px; border-radius: 0; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 15px; color: var(--text); max-width: 100%;
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]), .field select, .field textarea { width: 100%; }
.field textarea { resize: vertical; }
.field_with_errors { display: contents; }
.field_with_errors input, .field_with_errors select, .field_with_errors textarea, [aria-invalid="true"] { border: 2px solid var(--red) !important; }
.field--checks { justify-content: flex-start; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check--small { font-weight: 400; font-size: 14.5px; }
.checkrow { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; }
.inlineform { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 6px 6px 0; }
.span-all { grid-column: 1 / -1; }
.filterform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 16px; padding: 24px; background: var(--raised); border: 1px solid var(--border); }

/* Qualifikation a/b/c/– */
.qualis { display: flex; flex-direction: column; }
.quali { border: 0; margin: 0; padding: 8px 0; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.quali__dept { float: left; padding: 0; font-weight: 500; }
.levelpick { display: flex; gap: 4px; }
.levelpick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.levelpick__opt { min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 600; }
.levelpick input:focus-visible + .levelpick__opt { outline: 3px solid var(--accent); outline-offset: 3px; }
.levelpick input:checked + .levelpick__opt { box-shadow: inset 0 -3px 0 var(--accent); }
.levelpick input:checked + .levelpick__opt--a { background: var(--soft-text); border-color: var(--soft-text); color: var(--surface); }
.levelpick input:checked + .levelpick__opt--b { background: var(--soft); border-color: var(--soft-border); color: var(--soft-text); }
.levelpick input:checked + .levelpick__opt--c { background: var(--raised); border-color: var(--border-strong); color: var(--text); }
.levelpick input:checked + .levelpick__opt--none { background: var(--raised); border-color: var(--border-strong); color: var(--text2); }
.qualis .actions { margin-top: 14px; }

/* Verfügbarkeit */
.avail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.avail__row { display: grid; grid-template-columns: 32px minmax(60px, 1fr) auto auto; align-items: center; gap: 12px; }
.avail__day { font-weight: 700; }
.avail__bar { position: relative; height: 12px; background: var(--raised); border: 1px solid var(--border); }
.avail__bar span { position: absolute; top: 0; bottom: 0; background: var(--soft-text); }
.avail__time { color: var(--text2); font-size: 14.5px; }
.availform { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; align-items: end; padding-top: 14px; border-top: 1px solid var(--border); }

/* Abwesenheiten */
.weekhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.weekhead__actions { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 8px; }
.weekhead__actions form { margin: 0; }
.legend { display: inline-flex; flex-wrap: wrap; gap: 6px 16px; margin-left: auto; font-size: 13.5px; color: var(--text2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 10px; }
.swatch--vacation { background: var(--bar-vacation); }
.swatch--sick { background: var(--bar-sick); }
.swatch--other { background: var(--bar-other); }

.weekgrid { min-width: 760px; }
.weekgrid__row { display: grid; grid-template-columns: 170px repeat(7, minmax(0, 1fr)); align-items: center; min-height: 44px; border-bottom: 1px solid var(--border); }
.weekgrid__row:last-child { border-bottom: 0; }
.weekgrid__row--head { background: var(--raised); min-height: 40px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.weekgrid__name { grid-column: 1; padding: 8px 20px; font-weight: 600; }
.weekgrid__day { padding: 8px 10px; font-weight: 700; border-left: 1px solid var(--border); }
.weekgrid__day.is-today { background: var(--soft); color: var(--soft-text); box-shadow: inset 0 -3px 0 var(--soft-text); }
.weekgrid__empty { margin: 16px 20px; }
.weekgrid__cell { grid-row: 1; display: flex; }
.weekbar { flex: 1; margin: 4px; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding: 4px 10px; color: #fff; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.weekbar:hover { color: #fff; text-decoration: underline; }
.weekbar--vacation { background: var(--bar-vacation); }
.weekbar--sick { background: var(--bar-sick); }
.weekbar--other { background: var(--bar-other); }
.weekbar__more { font-weight: 400; font-size: 12.5px; }
.kind--vacation { background: var(--surface2); color: var(--text); border-color: var(--reihe-1); }
.kind--sick { background: var(--warn-bg); color: var(--red); border-color: var(--red); }
.kind--other { background: var(--raised); color: var(--text2); border-color: var(--border-strong); }
.plainlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plainlist li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }


/* Wochenplan */
.weeksummary { margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.weeknotes p { margin: 0 0 8px; }
.weekdispatch { margin: 12px 20px 0; }
.plangrid { min-width: 980px; table-layout: fixed; }
.plangrid th[scope="row"] { width: 170px; font-weight: 700; color: var(--text); background: var(--raised); text-transform: none; letter-spacing: 0; font-size: 14.5px; white-space: normal; }
.plangrid thead th:first-child { width: 170px; }
.plangrid th.is-today { background: var(--soft); color: var(--soft-text); box-shadow: inset 0 -3px 0 var(--soft-text); }
.plangrid td { padding: 8px; border-left: 1px solid var(--border); }
.plangrid tbody tr:hover { background: transparent; }
.planshift { padding: 6px 8px; background: var(--surface2); border: 1px solid var(--border); font-size: 13.5px; }
.planshift + .planshift { margin-top: 6px; }
.planshift--open { background: var(--warn-bg); border-color: var(--warn-bg); }
.planshift__title { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; color: var(--text2); }
.planshift__title > :first-child { min-width: 0; hyphens: auto; overflow-wrap: break-word; }
.planshift__count { font-weight: 500; color: var(--muted); white-space: nowrap; }
.planshift--open .planshift__count { color: var(--warn-text); font-weight: 700; }
.planshift__hint { font-size: 12.5px; color: var(--warn-text); }
.planshift__names { margin: 4px 0 0; padding: 0; list-style: none; color: var(--text); }
.planshift__link { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.planshift__link:hover, .planshift__link:focus-visible { color: inherit; text-decoration-color: currentColor; }
.planshift__note { font-size: 12.5px; color: var(--muted); }
.planshift--cancelled { opacity: .7; }
.planshift--cancelled .planshift__title > :first-child { text-decoration: line-through; }
.planshift__names li.is-tentative { font-style: italic; }
.planshift__names li.is-conflict { color: var(--red); font-weight: 700; }
.planshift__names li.is-conflict::before { content: "! "; }
.planshift__names li.is-over { text-decoration: underline dotted var(--red); text-underline-offset: 3px; }
.planshift--conflict { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
.plangrid__absent th, .plangrid__absent td { background: var(--surface2); font-size: 13.5px; color: var(--text2); }
.plancell__add { display: flex; align-items: center; min-height: 44px; margin-top: 6px; font-size: 13px; color: var(--muted); padding: 0 6px; }
.plancell__add:hover, .plancell__add:focus-visible { color: var(--text); background: var(--raised); }
.assignlist, .candlist { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; }
.assignlist__item, .candlist__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.assignlist__who, .candlist__who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; flex: 1 1 260px; }
.candlist--blocked .candlist__who { color: var(--muted); }
.assignlist__item--conflict { background: var(--warn-bg); padding-left: 10px; padding-right: 10px; box-shadow: inset 4px 0 0 var(--red); }
.conflicttable td { vertical-align: middle; }
.conflicttable .reason { margin: 2px 4px 2px 0; }

/* Versand */
.dispatchtable td:first-child { width: 44px; }
.dispatchtable input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.dispatchtable .is-failed { color: var(--red); font-weight: 700; }

/* Vorlauf, Sicherung */
.outlooktable tr.is-late th[scope="row"] { box-shadow: inset 4px 0 0 var(--red); }
.outlooktable th[scope="row"] .small { display: block; }
.backupstatus { margin-top: 4px; }
.backupstatus.is-late { color: var(--red); font-weight: 700; }

/* Bis 1200px: schmalere Leiste */
@media (max-width: 1200px) {
  :root { --sidebar: 216px; }
}

/* Bis 760px: Leiste wird Kopfzeile mit Menü */
@media (max-width: 760px) {
  .is-signed-in .sidebar { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .brand { flex: 1 1 auto; padding: 0; }
  .brand__logo img { width: 48px; height: 48px; }
  .sidebar.has-menu .menutoggle { display: inline-flex; }
  .sidebar__menu { flex: 1 1 100%; }
  .sidebar.has-menu:not(.is-open) .sidebar__menu { display: none; }
  .navlabel { display: none; }
  .mainnav { padding-top: .5rem; border-top: 1px solid var(--border); margin-top: .25rem; }
  .mainnav__link { padding-left: 16px; }
  .mainnav__link[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .account { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: .5rem; padding: .65rem 0 .5rem; border-top: 1px solid var(--border); }
  .account__who { padding: 0; border: 0; }
  .account .btn { width: auto; }
  .is-signed-in .page, .is-signed-in .footer { margin-left: 0; }
  .page { padding: 1.75rem 16px; min-height: 55vh; }
  .footer { padding: 1rem 16px; }
  .pagehead h1 { font-size: 2rem; }
  .pagehead { align-items: flex-start; flex-direction: column; }
  .columns > .card { flex-basis: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .stat { padding: 1rem; overflow-wrap: anywhere; }
  .filterform { padding: 16px; }
  .table th, .table td { padding: 10px 12px; }
  .weekhead__actions, .legend { margin-left: 0; }
  .btn { white-space: normal; overflow-wrap: break-word; }
  .table .btn { white-space: nowrap; }
}

/* Bis 440px: durchgehend einspaltig */
@media (max-width: 440px) {
  .stats { grid-template-columns: 1fr; }
  .formgrid, .formgrid--dates, .formgrid--times { grid-template-columns: 1fr; }
  .pagehead__actions, .pagehead__actions .btn { width: 100%; }
  .filterform > * { flex: 1 1 100%; }
  .avail__row { grid-template-columns: 32px 1fr auto; }
  .avail__bar { display: none; }
}

/* Anmeldung: Logo, Überschrift und Formular als eine Spalte in der Mitte des
   Fensters, Fußzeile unten. Steht nach den Umbruchregeln, damit sie gewinnt. */
.is-signed-out { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.is-signed-out .sidebar { margin-top: auto; padding: 32px 16px 0; background: none; border: 0; }
.is-signed-out .brand { flex: 0 0 auto; flex-direction: column; align-self: center; gap: 10px; padding: 0; text-align: center; }
.is-signed-out .brand__logo img { width: 96px; height: 96px; }
.is-signed-out .page { width: 100%; max-width: 440px; min-height: 0; margin: 0 auto; padding: 24px 0 32px; gap: 16px; }
.is-signed-out .footer { margin-top: auto; justify-content: center; }
.signin { display: flex; flex-direction: column; gap: 20px; }
.signin h1 { text-align: center; }
.signin .card { padding: 28px; }
.signin .btn--primary { width: 100%; }
.signin .hint { text-align: center; }
@media (max-width: 760px) {
  .is-signed-out .page { max-width: 472px; padding: 20px 16px 28px; }
  .signin .card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Druck/PDF: immer hell, A4, nur der Inhalt */
@page { size: A4; margin: 12mm; }
@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff; --side: #fff; --surface: #fff; --surface2: #fff; --raised: #f0f0f0;
    --text: #222; --text2: #333; --muted: #555; --border: #bbb; --border-strong: #bbb;
    --accent: #c0181d; --red: #c0181d; --link: #222;
    --soft: #f0f4e3; --soft-border: #bbb; --soft-text: #4a6618;
    --warn-bg: #fbf0d9; --warn-text: #7a4f00;
    --brand-soft: #fff; --logo-bg: transparent;
  }
  body { font-size: 11pt; }
  .sidebar, .skiplink, .footer, .filterform, .btn, .segmented, .actions, .pagehead__actions, .weekhead__actions, .plancell__add, form.inline, .inlineform { display: none !important; }
  .is-signed-in .page { margin: 0; padding: 0; min-height: 0; max-width: none; }
  .card, .stat, .planshift, .flash, tr, .assignlist__item, .candlist__item { break-inside: avoid; }
  h1, h2, h3, .cardhead, .weekhead, .sectionhead { break-after: avoid; }
  .tablewrap { overflow: visible; }
  .plangrid { min-width: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
