/* ==========================================================================
   Urlaubsplaner — Design System · JET Corporate Identity
   JET-Blau  #164194  (offizielles Logo-SVG, fill:#164194)
   JET-Gelb  #FBBA00  (dominante Flächenfarbe jet.de)
   Blau = Primäraktion · Gelb = Marke, Heute, Feiertag, Signal
   ========================================================================== */

@import url('/assets/css/fonts.css');

/* --------------------------------------------------------------- Tokens */

:root {
  color-scheme: light;

  /* Marke (JET) */
  --jet-blue: #164194;
  --jet-blue-dark: #0f2f6e;
  --jet-yellow: #fbba00;
  --jet-yellow-dark: #d69d00;

  /* Flächen */
  --bg: #f1f4f9;
  --bg-grad: radial-gradient(120% 80% at 100% 0%, #ffffff 0%, #f3f6fb 52%, #e8edf6 100%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf1f8;
  --surface-hover: #f4f7fc;

  /* Text */
  --ink: #101d33;
  --ink-2: #4b5a75;
  --ink-3: #62718c;
  --ink-inv: #ffffff;

  /* Linien */
  --line: #dde4ef;
  --line-2: #c6d1e2;
  --line-strong: #a7b5cb;

  /* Aktion / Akzent */
  --primary: #164194;
  --primary-hover: #0f2f6e;
  --primary-soft: #e3eaf7;
  --primary-ink: #0f2f6e;
  --accent: #fbba00;
  --accent-ink: #7a5c00;
  --accent-soft: #fff3d3;

  /* Semantik */
  --ok: #1e7a4f;
  --ok-soft: #e0f1e8;
  --warn: #8b6100;
  --warn-soft: #fff3d3;
  --danger: #c22b2b;
  --danger-soft: #fce7e7;
  --danger-line: #eda9a9;

  /* Abwesenheitsarten */
  --t-urlaub: #164194;
  --t-urlaub-ink: #ffffff;
  --t-sonderurlaub: #6f4fa8;
  --t-krank: #c0392b;
  --t-unbezahlt: #5e6c82;
  --t-schule: #10786f;

  /* Kalender */
  --weekend-tint: #e8edf6;
  --holiday-tint: #fdf0cb;
  --holiday-line: #e6c25f;
  --obs-tint: #eef3fb;
  --obs-line: #b9cbe8;
  --bridge-tint: rgba(251, 186, 0, 0.16);
  --bridge-stripe: rgba(214, 157, 0, 0.42);
  --bridge-ink: #8b6100;
  --today-line: #fbba00;
  --conflict-tint: rgba(194, 43, 43, 0.1);

  /* Stations-Akzente */
  --acc-blue: #164194;
  --acc-amber: #c08800;
  --acc-teal: #10786f;
  --acc-violet: #6f4fa8;
  --acc-rose: #b0355f;
  --acc-lime: #4f7d1b;
  --acc-cyan: #0e6e8c;
  --acc-orange: #c25a16;

  /* Form */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(24, 20, 12, 0.05), 0 1px 3px rgba(24, 20, 12, 0.04);
  --shadow-2: 0 2px 6px rgba(24, 20, 12, 0.06), 0 8px 24px -8px rgba(24, 20, 12, 0.14);
  --shadow-3: 0 18px 48px -12px rgba(24, 20, 12, 0.28), 0 2px 8px rgba(24, 20, 12, 0.08);

  /* Raster (dicht — Dashboard) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --font-head: 'Outfit', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --head-w: 344px;
  --rstat-w: 58px;
  --cell: 28px;
  --row-h: 48px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c1320;
  --bg-grad: radial-gradient(120% 80% at 100% 0%, #17233a 0%, #101a2b 52%, #0b111d 100%);
  --surface: #141d2e;
  --surface-2: #1a2436;
  --surface-3: #212d43;
  --surface-hover: #1e2a3e;

  --ink: #e9eef6;
  --ink-2: #a4b2c8;
  --ink-3: #8695ad;

  --line: #27334a;
  --line-2: #34425c;
  --line-strong: #475877;

  --primary: #5e93e0;
  --primary-hover: #79a7e9;
  --primary-soft: #17284a;
  --primary-ink: #a9c7f2;
  --accent: #fbba00;
  --accent-ink: #fbba00;
  --accent-soft: #35290a;

  --ok: #4cb383;
  --ok-soft: #102b1f;
  --warn: #e0a92c;
  --warn-soft: #33280c;
  --danger: #e2705f;
  --danger-soft: #331817;
  --danger-line: #7c3833;

  --t-urlaub: #3e73cf;
  --t-sonderurlaub: #7f5ab1;
  --t-krank: #c44a38;
  --t-unbezahlt: #66748c;
  --t-schule: #1c8073;

  --weekend-tint: #1c2637;
  --holiday-tint: #372c10;
  --holiday-line: #7a6220;
  --obs-tint: #1b2740;
  --obs-line: #35496e;
  --bridge-tint: rgba(251, 186, 0, 0.14);
  --bridge-stripe: rgba(251, 186, 0, 0.4);
  --bridge-ink: #e0a92c;
  --today-line: #fbba00;
  --conflict-tint: rgba(226, 112, 95, 0.14);

  --acc-blue: #5e93e0;
  --acc-amber: #fbba00;
  --acc-teal: #34a49a;
  --acc-violet: #9576c4;
  --acc-rose: #d1698d;
  --acc-lime: #8fb548;
  --acc-cyan: #38a0b8;
  --acc-orange: #dd8b4a;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 20px 56px -14px rgba(0, 0, 0, 0.75), 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------------- Reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  /* Platz für den Scrollbalken immer reservieren — sonst springt die Breite,
     sobald eine Seite länger wird, und das Monatsraster verrechnet sich. */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.175rem; }
h3 { font-size: 1rem; }

p { margin: 0; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- Buttons */

.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--btn-line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), transform 0.12s var(--ease), box-shadow 0.16s var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  --btn-bg: var(--primary);
  --btn-ink: #fff;
  --btn-line: transparent;
  box-shadow: var(--shadow-1);
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: transparent;
}

html[data-theme='dark'] .btn--primary {
  --btn-ink: #0b1526;
}

/* JET-Akzentbutton: gelbe Fläche, blaue Schrift (Signaturkombination) */
.btn--accent {
  --btn-bg: var(--jet-yellow, #fbba00);
  --btn-ink: var(--jet-blue-dark, #0f2f6e);
  --btn-line: transparent;
  font-weight: 650;
  box-shadow: var(--shadow-1);
}

.btn--accent:hover:not(:disabled) {
  background: var(--jet-yellow-dark, #d69d00);
  border-color: transparent;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-line: transparent;
  color: var(--ink-2);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: transparent;
  color: var(--ink);
}

.btn--danger {
  --btn-ink: var(--danger);
  --btn-line: var(--danger-line);
  --btn-bg: transparent;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn--sm {
  min-height: 32px;
  padding: 0 var(--sp-3);
  font-size: 0.8125rem;
}

.btn--icon {
  min-width: 38px;
  padding: 0;
}

.btn--icon.btn--sm {
  min-width: 32px;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

/* ---------------------------------------------------------------- Inputs */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > label,
.label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.input,
.select,
textarea.input {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  width: 100%;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input:hover,
.select:hover {
  border-color: var(--line-strong);
}

.input:focus,
.select:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.input[type='number'] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238b939f' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  cursor: pointer;
}

html[data-theme='dark'] .select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2379818d' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.field-hint {
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* Status-Ersatz für Arten ohne Genehmigungspflicht (Krank, Schule) */
.statusfixed {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 5px 11px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
}

.statusfixed svg { flex: none; color: var(--ok); }

.field-error {
  font-size: 0.8125rem;
  color: var(--danger);
  font-weight: 500;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: 0.875rem;
}

.switch input {
  appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-2);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s var(--ease);
  flex: none;
}

.switch input::after {
  content: '';
  position: absolute;
  inset: 3px auto 3px 3px;
  width: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s var(--ease);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.switch input:checked {
  background: var(--primary);
}

.switch input:checked::after {
  transform: translateX(16px);
}

/* --------------------------------------------------------- Grundbausteine */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.card__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card__title small {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.card__body {
  padding: var(--sp-5);
}

.card__body--flush {
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip--vollzeit { background: var(--primary-soft); color: var(--primary-ink); }
.chip--teilzeit { background: var(--ok-soft); color: var(--ok); }
.chip--minijob { background: var(--accent-soft); color: var(--warn); }
.chip--aushilfe { background: var(--surface-3); color: var(--ink-2); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--dot, var(--ink-3));
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.tiny { font-size: 0.75rem; }
.small { font-size: 0.8125rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------- Segmente */

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* -------------------------------------------------------------- App-Shell */

.app {
  --sidebar-w: 232px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  transition: grid-template-columns 0.26s var(--ease);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-4);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--sp-2);
}

/* Ein-/Ausklappen der Seitenleiste */
.railtoggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.railtoggle svg { width: 19px; height: 19px; }

.railtoggle:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--line);
}

.railtoggle__arrow { transition: transform 0.24s var(--ease); transform-origin: 13px 12px; }

/* JET-Signatur: gelbe Kachel, blaues Zeichen */
.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--jet-yellow, #fbba00);
  display: grid;
  place-items: center;
  color: var(--jet-blue, #164194);
  flex: none;
  box-shadow: var(--shadow-1);
}

.brand__mark svg { width: 19px; height: 19px; }

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand__text strong {
  font-family: var(--font-head);
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.brand__text span {
  font-size: 0.6875rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__label {
  font-size: 0.6875rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  padding: 0 var(--sp-2) var(--sp-2);
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }

.nav a:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.nav a[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--jet-yellow, #fbba00);
}

.nav a[aria-current='page'] svg { opacity: 1; }

.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Wer ist angemeldet? */
.userbadge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-1);
  min-width: 0;
}

.userbadge__avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-size: 0.75rem;
  font-weight: 700;
}

.userbadge__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.userbadge__text strong {
  font-size: 0.8125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbadge__text span {
  font-size: 0.6875rem;
  color: var(--ink-3);
}

/* ---------------------------------------- Eingeklappte Seitenleiste (Rail) */

@media (min-width: 1081px) {
  html[data-sidebar='collapsed'] .app { --sidebar-w: 74px; }

  html[data-sidebar='collapsed'] .sidebar {
    padding-left: 11px;
    padding-right: 11px;
    align-items: center;
  }

  html[data-sidebar='collapsed'] .brand {
    flex-direction: column;
    gap: var(--sp-2);
    padding: 0;
  }

  html[data-sidebar='collapsed'] .brand__text { display: none; }
  html[data-sidebar='collapsed'] .railtoggle { margin-left: 0; }
  html[data-sidebar='collapsed'] .railtoggle__arrow { transform: rotate(180deg); }
  html[data-sidebar='collapsed'] .nav__label { display: none; }

  html[data-sidebar='collapsed'] .nav a {
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 44px;
    margin: 0 auto;
  }

  html[data-sidebar='collapsed'] .nav a > span { display: none; }
  html[data-sidebar='collapsed'] .nav a svg { width: 21px; height: 21px; }

  html[data-sidebar='collapsed'] .sidebar__foot .btn {
    width: 48px;
    min-width: 48px;
    padding: 0;
    margin: 0 auto;
  }

  html[data-sidebar='collapsed'] .sidebar__foot .btn > span:not(#themeIcon) { display: none; }
  html[data-sidebar='collapsed'] .userbadge { justify-content: center; padding-left: 0; padding-right: 0; }
  html[data-sidebar='collapsed'] .userbadge__text { display: none; }
}

/* ------------------------------------------------------------------ Main */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.topbar__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: auto;
}

.topbar__title h1 {
  font-size: 1.125rem;
}

.topbar__title small {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.view {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  min-width: 0;
}

/* ========================================================== Startseite */

.startblock {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.startblock__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.startblock__head h2 { font-size: 1.25rem; }

/* --- Ortsschilder --- */

.signgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: var(--sp-5);
}

.sign {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Das Schild bleibt in beiden Themes gelb-schwarz — ein Schild ist ein Schild. */
.sign__plate {
  --plate: #f7c500;
  --plate-ink: #14140f;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border: 3px solid var(--plate-ink);
  border-radius: 5px;
  background: var(--plate);
  color: var(--plate-ink);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.55);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), background-color 0.16s var(--ease);
}

/* feine Innenlinie wie beim echten Verkehrszeichen */
.sign__plate::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid color-mix(in srgb, var(--plate-ink) 28%, transparent);
  border-radius: 3px;
  pointer-events: none;
}

.sign__plate:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.6);
  background: color-mix(in srgb, var(--plate) 88%, #fff);
}

.sign__plate:active { transform: translateY(0); }

.sign--active .sign__plate {
  box-shadow: 0 0 0 4px var(--primary), 0 10px 24px -10px rgba(0, 0, 0, 0.6);
}

.sign__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--plate-ink) 10%, transparent);
  color: var(--plate-ink);
}

.sign__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.sign__brand {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  opacity: 0.6;
}

.sign__name {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sign__sub {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.72;
}

/* Pfosten unter dem Schild */
.sign__post {
  width: 9px;
  height: 16px;
  background: linear-gradient(180deg, var(--line-strong), var(--line-2));
  border-radius: 0 0 2px 2px;
}

.sign__stats {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.sign__count b { color: var(--ink); font-weight: 700; }

.sign__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* --- Team-Gruppen --- */

.teamgroup {
  /* gemeinsame Spaltenmaße für Kopf- und Mitarbeiterzeilen */
  --team-name-w: 260px;
  --team-indent: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.teamgroup__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 0;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.16s var(--ease);
}

.teamgroup__head:hover { background: var(--surface-3); }

/* feste Spalte, damit die Namen darunter exakt fluchten */
.teamgroup__lead {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 var(--team-indent);
  width: var(--team-indent);
}

.teamgroup__chev {
  display: grid;
  place-items: center;
  color: var(--ink-2);
  transition: transform 0.2s var(--ease);
}

.teamgroup__chev[data-collapsed='1'] { transform: rotate(-90deg); }

.teamgroup__bar {
  width: 4px;
  height: 24px;
  border-radius: 2px;
  flex: none;
}

/* Titelspalte und Zahlenspalte fluchten mit den Mitarbeiterzeilen darunter */
.teamgroup__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 var(--team-name-w);
  width: var(--team-name-w);
  min-width: 0;
}

.teamgroup__name {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teamgroup__sums {
  display: flex;
  gap: var(--sp-4);
  flex: none;
}

.teamgroup__body { display: flex; flex-direction: column; }

/* --- Mitarbeiterzeile --- */

.teamrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  /* links eingerückt wie die Kopfzeile, damit die Spalten fluchten */
  padding: 11px var(--sp-4) 11px calc(var(--sp-4) + var(--team-indent) + var(--sp-3));
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s var(--ease);
}

.teamrow:last-child { border-bottom: 0; }
.teamrow:hover { background: var(--surface-hover); }
.teamrow:hover .teamrow__name { color: var(--primary); }
.teamrow:hover .teamrow__go { opacity: 1; transform: translateX(2px); }

.teamrow__person {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  /* feste Breite statt „wächst mit“ — so rückt alles nach links zusammen */
  flex: 0 0 var(--team-name-w);
  width: var(--team-name-w);
}

.teamrow__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.16s var(--ease);
}

.teamrow__tags {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.teamrow__nums {
  display: flex;
  gap: var(--sp-4);
  flex: none;
}

.teamrow__go {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  opacity: 0.5;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}

/* --- Füllbalken mit Beschriftung „21 von 34“ --- */

.fillbar {
  position: relative;
  flex: none;
  width: 190px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}

.fillbar__taken,
.fillbar__planned {
  position: absolute;
  top: 0;
  bottom: 0;
}

/* bewusst nur getönt — so bleibt die Beschriftung an jeder Stelle lesbar */
.fillbar__taken {
  left: 0;
  background: color-mix(in srgb, var(--t-urlaub) 34%, transparent);
}

.fillbar__planned {
  background: color-mix(in srgb, var(--t-urlaub) 16%, transparent);
  background-image: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--t-urlaub) 22%, transparent) 0 3px,
    transparent 3px 7px
  );
}

/* kräftige Kante markiert den Füllstand exakt */
.fillbar__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--t-urlaub);
}

.fillbar__label {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.fillbar--over {
  border-color: var(--danger-line);
}

.fillbar--over .fillbar__taken {
  background: color-mix(in srgb, var(--danger) 30%, transparent);
}

.fillbar--over .fillbar__planned {
  background-image: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--danger) 26%, transparent) 0 3px,
    transparent 3px 7px
  );
}

.fillbar--over .fillbar__label { color: var(--danger); }

/* --- Zahlenblock mit Beschriftung --- */

.numblock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 52px;
  line-height: 1.1;
}

.numblock b {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.numblock small {
  font-size: 0.5625rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.numblock--taken b { color: var(--t-urlaub); }
.numblock--free b { color: var(--ok); }
.numblock--over b { color: var(--danger); }

@media (max-width: 900px) {
  .teamgroup { --team-name-w: 180px; --team-indent: 34px; }
  .teamrow { flex-wrap: wrap; }
  .fillbar { display: none; }
  .teamgroup__sums { gap: var(--sp-3); }
  .teamrow__nums { gap: var(--sp-3); }
  .numblock { min-width: 46px; }
  .numblock small { font-size: 0.5rem; }
}

/* --------------------------------------------------------------- Station-Tabs */

.station-tabs {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.station-tab {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background-color 0.16s var(--ease);
  text-align: left;
}

.station-tab:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.station-tab[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--acc) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 35%, transparent), var(--shadow-1);
  background: var(--surface);
}

.station-tab__bar {
  width: 4px;
  height: 26px;
  border-radius: 2px;
  background: var(--acc);
  flex: none;
}

.station-tab__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.station-tab__meta strong {
  font-size: 0.875rem;
  font-weight: 600;
}

.station-tab__meta span {
  font-size: 0.6875rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.station-tab__flag {
  margin-left: var(--sp-1);
}

/* ------------------------------------------------------------------ KPIs */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-1);
}

.kpi__label {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kpi__value {
  font-family: var(--font-head);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi__hint {
  font-size: 0.75rem;
  color: var(--ink-2);
}

.kpi--danger .kpi__value { color: var(--danger); }
.kpi--ok .kpi__value { color: var(--ok); }
.kpi--warn .kpi__value { color: var(--warn); }

/* ======================================================== Jahres-Raster */

.gridwrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.gridscroll {
  overflow: auto;
  max-height: min(74vh, 860px);
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  /* rastet sanft auf Monatsanfänge ein, damit ein voller Monat sichtbar ist */
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--head-w);
}

.gridscroll::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.gridscroll::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 6px;
  border: 3px solid var(--surface);
}

.gridscroll::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}

.grid {
  --days: 365;
  --track-w: calc(var(--days) * var(--cell));
  width: calc(var(--head-w) + var(--track-w));
  position: relative;
}

/* Kopfzeile */

.ghead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--line);
}

.ghead__row {
  display: flex;
  height: 34px;
}

.ghead__row--days {
  height: 32px;
}

.ghead__corner {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--head-w);
  flex: none;
  background: var(--surface-2);
  border-right: 2px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3) 0 var(--sp-4);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ghead__year { flex: none; white-space: nowrap; }

/* Beschriftungen exakt über den Zahlen der Mitarbeiterzeilen */
.ghead__corner--labels .rstat {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.ghead__months,
.ghead__days {
  display: flex;
  width: var(--track-w);
  position: relative;
}

.gmonth {
  flex: none;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-right: 2px solid var(--line-2);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.gmonth--alt { background: color-mix(in srgb, var(--ink) 4%, transparent); }

.gmonth:hover {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.gmonth__hint { opacity: 0; transition: opacity 0.16s var(--ease); display: grid; }
.gmonth:hover .gmonth__hint { opacity: 0.7; }
.gmonth__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gday {
  flex: none;
  width: var(--cell);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  line-height: 1.05;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.gday--alt { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.gday--we { color: var(--ink-3); background: var(--weekend-tint); }
.gday--obs { background: var(--obs-tint); box-shadow: inset 0 -2px 0 var(--obs-line); }
.gday--hol { background: var(--holiday-tint); color: var(--warn); font-weight: 700; }

.gday--bridge {
  position: relative;
  color: var(--bridge-ink);
  font-weight: 700;
}

.gday__bridge {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--jet-yellow, #fbba00);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bridge-ink) 55%, transparent);
}
.gday--today { color: var(--ink-inv); background: var(--accent); font-weight: 700; border-radius: 4px; }
html[data-theme='dark'] .gday--today { color: #1a1207; }
.gday__num { letter-spacing: -0.02em; }
.gday__wd { font-size: 0.5625rem; opacity: 0.7; }
.gday--month-start { box-shadow: inset 2px 0 0 var(--line-2); }

/* Belegungszeile */

.grow-occ {
  display: flex;
  height: 34px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky;
  top: 56px;
  z-index: 19;
}

.grow-occ .rhead {
  background: var(--surface-2);
}

.occ-track {
  position: relative;
  width: var(--track-w);
  flex: none;
  display: flex;
  align-items: flex-end;
}

.occ-bar {
  position: absolute;
  bottom: 0;
  width: calc(var(--cell) - 1px);
  background: color-mix(in srgb, var(--primary) 42%, transparent);
  border-radius: 2px 2px 0 0;
  pointer-events: none;
}

.occ-bar--over {
  background: var(--danger);
}

/* Zeilen */

.grow-emp {
  display: flex;
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.grow-emp:last-child {
  border-bottom: 0;
}

.grow-emp:hover .rhead {
  background: var(--surface-hover);
}

.grow-emp:hover .rtrack {
  background-color: color-mix(in srgb, var(--primary) 4%, transparent);
}

.rhead {
  position: sticky;
  left: 0;
  z-index: 12;
  width: var(--head-w);
  flex: none;
  background: var(--surface);
  border-right: 2px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3) 0 var(--sp-4);
  transition: background-color 0.16s var(--ease);
}

.monthstep { display: inline-flex; gap: 2px; }

.rhead__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 3px;
}

.rhead__name button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 4px;
}

.rhead__name button:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rhead__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rhead__sub .meter { flex: 1 1 auto; min-width: 40px; max-width: 120px; }

/* Zahlen-Strip: gesamt · genommen · frei */

.rhead__stats {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0;
}

.rstat {
  width: var(--rstat-w);
  font-size: 0.5625rem;
  flex: none;
  display: grid;
  place-items: center;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rstat b {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}

.rstat--taken b { color: var(--t-urlaub); }

.rstat--free b {
  min-width: 38px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok);
}

.rstat--over b { background: var(--danger); color: #fff; }

.meter {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
  display: flex;
}

.meter i {
  display: block;
  height: 100%;
}

.meter__taken { background: var(--t-urlaub); }
.meter__planned { background: color-mix(in srgb, var(--t-urlaub) 45%, var(--surface-3)); }
.meter__over { background: var(--danger); }

/* Spur + Balken */

.rtrack {
  position: relative;
  width: var(--track-w);
  flex: none;
  cursor: cell;
  background-image: repeating-linear-gradient(
    90deg,
    var(--weekend-tint) 0 calc(2 * var(--cell)),
    transparent calc(2 * var(--cell)) calc(7 * var(--cell))
  );
  background-position-x: calc(var(--sat) * var(--cell));
  transition: background-color 0.16s var(--ease);
}

.rtrack::after {
  /* Tagesraster */
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--line) 55%, transparent) 0 1px,
    transparent 1px var(--cell)
  );
  pointer-events: none;
  opacity: 0.6;
}

.bar {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: calc(var(--from) * var(--cell));
  width: calc(var(--span) * var(--cell) - 2px);
  margin-left: 1px;
  border: 0;
  border-radius: 6px;
  background: var(--bar-bg, var(--t-urlaub));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 0 5px;
  overflow: hidden;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  transition: filter 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.12s var(--ease);
}

.bar:hover {
  filter: brightness(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  z-index: 6;
}

.bar:active {
  transform: translateY(1px);
}

.bar--urlaub { --bar-bg: var(--t-urlaub); }
.bar--sonderurlaub { --bar-bg: var(--t-sonderurlaub); }
.bar--krank { --bar-bg: var(--t-krank); }
.bar--unbezahlt { --bar-bg: var(--t-unbezahlt); }
.bar--schule { --bar-bg: var(--t-schule); }

.bar--geplant {
  background: color-mix(in srgb, var(--bar-bg) 20%, var(--surface));
  color: color-mix(in srgb, var(--bar-bg) 78%, var(--ink));
  border: 1px dashed color-mix(in srgb, var(--bar-bg) 65%, transparent);
  box-shadow: none;
}

.bar--conflict {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
}

.bar__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar__flag {
  margin-left: auto;
  flex: none;
  display: grid;
  place-items: center;
}

.bar__flag svg { width: 12px; height: 12px; }

.ghost {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: calc(var(--from) * var(--cell));
  width: calc(var(--span) * var(--cell));
  border: 2px dashed var(--primary);
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  pointer-events: none;
  z-index: 8;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--primary-ink);
}

/* Hintergrund-Layer (Feiertage, Monatslinien, Heute, Konflikte) */

.layer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--head-w);
  width: var(--track-w);
  pointer-events: none;
}

.layer--back { z-index: 1; }
/* über den Balken, aber unter der fixierten Namensspalte (.rhead = 12) */
.layer--front { z-index: 8; }

.mline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line-2);
}

/* abwechselnd getönte Monatsbänder */
.mband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--ink) 3.5%, transparent);
}

.holmark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--cell);
  background: var(--holiday-tint);
  box-shadow: inset 1px 0 0 var(--holiday-line), inset -1px 0 0 var(--holiday-line);
}

/* Karneval, Heiligabend & Co. — sichtbar, aber unaufdringlich */
.obsmark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--cell);
  background: var(--obs-tint);
  box-shadow: inset 0 -3px 0 var(--obs-line);
}

/* Brückentage — gelb schraffiert */
.bridgemark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--cell);
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(
    45deg,
    var(--bridge-stripe) 0 2px,
    transparent 2px 6px
  );
  box-shadow: inset 0 3px 0 var(--jet-yellow, #fbba00);
}

.todaymark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--cell);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 2px 0 0 var(--today-line);
}

.cstripe {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--cell);
  background: var(--conflict-tint);
  box-shadow: inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger);
}

/* Legende */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  align-items: center;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.75rem;
  color: var(--ink-2);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__swatch {
  width: 15px;
  height: 11px;
  border-radius: 3px;
  background: var(--sw, var(--t-urlaub));
  flex: none;
}

.legend__swatch--planned {
  background: color-mix(in srgb, var(--t-urlaub) 20%, var(--surface));
  border: 1px dashed var(--t-urlaub);
}

.legend__swatch--we { background: var(--weekend-tint); border: 1px solid var(--line-2); }
.legend__swatch--hol { background: var(--holiday-tint); border: 1px solid var(--holiday-line); }
.legend__swatch--obs { background: var(--obs-tint); border: 1px solid var(--obs-line); }

.legend__swatch--bridge {
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(45deg, var(--bridge-stripe) 0 2px, transparent 2px 6px);
  border: 1px solid color-mix(in srgb, var(--jet-yellow, #fbba00) 70%, transparent);
}

.legend__swatch--conf { background: var(--conflict-tint); box-shadow: inset 0 2px 0 var(--danger), inset 0 -2px 0 var(--danger); }

/* --------------------------------------------------------- Konfliktliste */

.conflicts {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.conflict {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  background: var(--danger-soft);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s var(--ease), box-shadow 0.16s var(--ease);
}

.conflict:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.conflict__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.conflict__icon svg { width: 17px; height: 17px; }

.conflict__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.conflict__body strong { font-size: 0.875rem; }
.conflict__body span { font-size: 0.8125rem; color: var(--ink-2); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--ink-2);
}

.empty svg { width: 30px; height: 30px; color: var(--ink-3); }
.empty strong { color: var(--ink); font-size: 0.9375rem; }

/* -------------------------------------------------------------- Tabellen */

.tablewrap {
  overflow: auto;
  scrollbar-width: thin;
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

table.data th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 9px var(--sp-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th.num,
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data td {
  padding: 7px var(--sp-3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tbody tr:hover td {
  background: var(--surface-hover);
}

table.data tbody tr.inactive td {
  opacity: 0.55;
}

table.data tr.group td {
  background: var(--surface-3);
  font-weight: 650;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 6px var(--sp-3);
  position: sticky;
  top: 32px;
  z-index: 1;
}

.cellinput {
  width: 64px;
  min-height: 30px;
  padding: 3px 7px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
  cursor: text;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.cellinput:hover { border-color: var(--primary); background: var(--surface); }

.cellinput:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.cellinput.saved {
  animation: flash 0.8s var(--ease);
}

@keyframes flash {
  0% { background: var(--ok-soft); border-color: var(--ok); }
  100% { background: var(--surface-3); border-color: var(--line); }
}

/* ============================================ Urlaubskonten-Tabelle (Ledger) */

.lg {
  --lg-name: 258px;
  --lg-num: 92px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.lg__wrap { scrollbar-width: thin; }

/* --- Kopfzeile --- */

.lg thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line-2);
  padding: 9px var(--sp-3);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  vertical-align: bottom;
}

.lg thead th small {
  display: block;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-3);
  opacity: 0.8;
}

/* --- Fixierte Spalten: Name + die vier Zahlen --- */

.lg .lg__name {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--lg-name);
  min-width: var(--lg-name);
  text-align: left;
  background: var(--surface);
  padding: 7px var(--sp-4);
}

.lg thead .lg__name { z-index: 5; background: var(--surface-2); }

.lg .lg__num {
  position: sticky;
  z-index: 3;
  width: var(--lg-num);
  min-width: var(--lg-num);
  text-align: right;
  background: var(--surface);
  padding: 6px var(--sp-3);
  font-variant-numeric: tabular-nums;
}

.lg thead .lg__num { z-index: 5; background: var(--surface-2); }

.lg .lg__c1 { left: var(--lg-name); }
.lg .lg__c2 { left: calc(var(--lg-name) + var(--lg-num)); }
.lg .lg__c3 { left: calc(var(--lg-name) + 2 * var(--lg-num)); }
.lg .lg__c4 { left: calc(var(--lg-name) + 3 * var(--lg-num)); }

/* Trennkante zwischen Zahlenblock und Monaten */
.lg .lg__rest-col {
  box-shadow: 2px 0 0 var(--line-2);
}

.lg--nomonths .lg__rest-col { box-shadow: none; }

/* --- Zeilen --- */

.lg tbody td {
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.lg tbody .lg__name,
.lg tbody .lg__num { border-bottom: 1px solid var(--line); }

/* Zebra — führt das Auge vom Namen zu den Zahlen */
.lg .lg__emprow--alt > td,
.lg .lg__emprow--alt .lg__name,
.lg .lg__emprow--alt .lg__num { background: var(--surface-2); }

.lg tbody tr:hover td,
.lg tbody tr:hover .lg__name,
.lg tbody tr:hover .lg__num { background: var(--surface-hover); }

/* Stationszeile */

.lg .lg__stationrow > td,
.lg .lg__stationrow .lg__name,
.lg .lg__stationrow .lg__num {
  background: var(--surface-3);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}

.lg .lg__stationrow:hover > td,
.lg .lg__stationrow:hover .lg__name,
.lg .lg__stationrow:hover .lg__num {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-3));
}

.lg__station {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.lg__bar {
  width: 4px;
  height: 22px;
  border-radius: 2px;
  flex: none;
}

.lg__stationname {
  font-family: var(--font-head);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lg__toggle {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 0.18s var(--ease), background-color 0.16s var(--ease);
}

.lg__toggle:hover { background: var(--surface); border-color: var(--line-2); }
.lg__toggle[data-collapsed='1'] { transform: rotate(-90deg); }

/* Mitarbeiterzeile */

.lg__person {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 34px;
  min-width: 0;
}

.lg__personhead {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.lg__personname {
  font-size: 0.9375rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg__person .meter { width: 100%; height: 5px; border-radius: 3px; }

/* ohne Monatsspalten rücken die Zahlen näher an die Namen */
.lg--nomonths { width: auto; min-width: min(100%, 780px); }
.lg--nomonths .lg__name { width: 42%; min-width: 260px; }
.lg--nomonths .lg__num { width: 120px; min-width: 120px; }

/* --- Zahlenwerte --- */

.lg__val {
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lg__val--taken { color: var(--t-urlaub); }
.lg__val--planned { color: var(--warn); }
.lg__val--zero { color: var(--ink-3); font-weight: 400; }

.lg__stationrow .lg__val { font-weight: 700; }

.lg__rest {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 1.0625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.lg__rest--ok { background: var(--ok-soft); color: var(--ok); }
.lg__rest--low { background: var(--warn-soft); color: var(--warn); }
.lg__rest--none { background: var(--surface-3); color: var(--ink-2); }
.lg__rest--over { background: var(--danger); color: #fff; }

/* --- Monatsspalten (bewusst zurückgenommen) --- */

.lg__month {
  width: 46px;
  min-width: 46px;
  text-align: center;
}

.lg thead .lg__month {
  color: var(--ink-3);
  font-weight: 600;
  padding: 9px 2px;
}

.lg__monthbtn {
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  text-transform: inherit;
  letter-spacing: inherit;
}

.lg__monthbtn:hover { color: var(--primary); background: var(--primary-soft); }

.mcell {
  display: block;
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 2px;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--ink-2);
  transition: background-color 0.16s var(--ease);
}

.mcell[data-level='0'] { color: var(--ink-3); font-weight: 400; }
.mcell[data-level='1'] { background: color-mix(in srgb, var(--t-urlaub) 10%, transparent); }
.mcell[data-level='2'] { background: color-mix(in srgb, var(--t-urlaub) 20%, transparent); }
.mcell[data-level='3'] { background: color-mix(in srgb, var(--t-urlaub) 32%, transparent); }
.mcell[data-level='4'] { background: color-mix(in srgb, var(--t-urlaub) 44%, transparent); }
.mcell:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--ink); }

.mcell[data-conflict='1'] {
  box-shadow: inset 0 0 0 2px var(--danger);
  color: var(--danger);
  font-weight: 700;
}

/* --- Legende --- */

.lg__legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 0.75rem;
  color: var(--ink-2);
}

.lg__legenditem { display: inline-flex; align-items: center; gap: 6px; }

.lg__swatch {
  width: 14px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}

.lg__swatch--taken { background: var(--t-urlaub); }
.lg__swatch--planned { background: color-mix(in srgb, var(--t-urlaub) 45%, var(--surface-3)); }
.lg__swatch--free { background: var(--surface-3); border: 1px solid var(--line-2); }

/* Auf schmalen Bildschirmen nur den Namen fixieren */
@media (max-width: 1100px) {
  .lg { --lg-name: 190px; --lg-num: 78px; }
  .lg .lg__num { position: static; }
  .lg .lg__rest-col { box-shadow: none; }
  .lg__val, .lg__rest { font-size: 0.9375rem; }
  .lg__person { padding-left: 26px; }
}

/* --------------------------------------------------- Monatsdetail-Raster */

.monthgrid {
  overflow: auto;
  scrollbar-width: thin;
}

.mg {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
}

.mg th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--ink-3);
  padding: 4px 0;
  width: 30px;
  min-width: 30px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mg th.namecol {
  left: 0;
  z-index: 3;
  width: 210px;
  min-width: 210px;
  text-align: left;
  padding: 6px var(--sp-4);
  border-right: 1px solid var(--line);
}

.mg th.we { background: var(--weekend-tint); }
.mg th.hol { background: var(--holiday-tint); color: var(--warn); }

.mg td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  height: 28px;
  padding: 0;
  text-align: center;
}

.mg td.namecol {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  padding: 3px var(--sp-4);
  text-align: left;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  font-size: 0.8125rem;
}

.mg tr:hover td { background: var(--surface-hover); }
.mg tr:hover td.namecol { background: var(--surface-hover); }

.mg tr.grouprow td {
  background: var(--surface-3);
  font-weight: 650;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  height: 24px;
}

.mg td.we { background: var(--weekend-tint); }
.mg th.obs,
.mg td.obs { background: var(--obs-tint); }
.mg td.hol { background: var(--holiday-tint); }

.mg th.bridge,
.mg td.bridge {
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(45deg, var(--bridge-stripe) 0 2px, transparent 2px 6px);
}

.mg th.bridge { color: var(--bridge-ink); box-shadow: inset 0 2px 0 var(--jet-yellow, #fbba00); }

/* ------------------------------------- Feiertags- und Sondertage-Listen */

.holirow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.holirow:last-child { border-bottom: 0; }

.holirow__date {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.holirow__date b {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.holirow__date span {
  font-size: 0.6875rem;
  color: var(--ink-3);
}

.holirow__name {
  font-size: 0.875rem;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

/* feste Spalte — die Schaltfläche darf den Namen nie überdecken */
.holirow__action {
  flex: none;
  justify-self: end;
  display: flex;
  min-width: 92px;
  justify-content: flex-end;
}

.holirow__action .chip { white-space: nowrap; }

/* Umschalter „als frei übernehmen“ / „zurücknehmen“ */

.obsbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  min-width: 84px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.obsbtn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.obsbtn--on {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  color: var(--ok);
  font-weight: 650;
}

.obsbtn--on:hover {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.obsbtn__undo { display: none; }
.obsbtn--on:hover .obsbtn__state { display: none; }
.obsbtn--on:hover .obsbtn__undo,
.obsbtn--on:focus-visible .obsbtn__undo { display: inline-flex; align-items: center; gap: 5px; }
.obsbtn--on:focus-visible .obsbtn__state { display: none; }
.obsbtn__state { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------- Brückentage-Liste */

.bridgerow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 9px var(--sp-3) 9px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  position: relative;
}

/* schmale Schraffur als Erkennungsmerkmal, Text bleibt auf ruhiger Fläche */
.bridgerow::before {
  content: '';
  width: 10px;
  align-self: stretch;
  flex: none;
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(45deg, var(--bridge-stripe) 0 2px, transparent 2px 6px);
  border-right: 1px solid color-mix(in srgb, var(--jet-yellow, #fbba00) 55%, transparent);
}

.bridgerow__days { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.bridgerow__day {
  display: inline-flex;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

.bridgerow__day b { color: var(--ink-2); font-weight: 650; }

.bridgerow__gain {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 650;
  white-space: nowrap;
}

html[data-theme='dark'] .bridgerow__gain { color: var(--jet-yellow, #fbba00); }

.mg .mark {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 22px;
  border: 0;
  cursor: pointer;
  background: var(--mk, var(--t-urlaub));
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 26px;
}

.mg .mark--geplant {
  background: color-mix(in srgb, var(--mk) 22%, var(--surface));
  color: color-mix(in srgb, var(--mk) 80%, var(--ink));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mk) 55%, transparent);
}

.mg .mark--conflict { box-shadow: inset 0 0 0 2px var(--danger); }

/* ==================================== Ansichts-Umschalter (hervorgehoben) */

.viewswitch {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--jet-blue, #164194);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.viewswitch__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex: none;
}

.viewswitch__label::after {
  content: '';
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--jet-yellow, #fbba00);
}

.viewswitch__group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.viewswitch__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.14s var(--ease);
}

.viewswitch__btn svg { width: 19px; height: 19px; flex: none; opacity: 0.8; }

.viewswitch__btn:hover {
  border-color: var(--jet-blue, #164194);
  color: var(--ink);
  background: var(--surface);
  transform: translateY(-1px);
}

.viewswitch__btn[aria-pressed='true'] {
  background: var(--jet-blue, #164194);
  border-color: var(--jet-blue, #164194);
  color: #fff;
  box-shadow: 0 3px 10px -3px color-mix(in srgb, var(--jet-blue, #164194) 55%, transparent);
  transform: none;
}

.viewswitch__btn[aria-pressed='true'] svg { opacity: 1; }

/* gelber JET-Indikator unter dem aktiven Zustand */
.viewswitch__btn[aria-pressed='true']::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 3px;
  border-radius: 2px;
  background: var(--jet-yellow, #fbba00);
}

html[data-theme='dark'] .viewswitch__btn[aria-pressed='true'] {
  background: var(--jet-blue, #164194);
  border-color: color-mix(in srgb, var(--jet-yellow, #fbba00) 45%, var(--jet-blue, #164194));
  color: #fff;
}

.viewswitch__hint {
  font-size: 0.8125rem;
  color: var(--ink-2);
  flex: 1 1 220px;
  min-width: 0;
}

@media (max-width: 640px) {
  .viewswitch { gap: var(--sp-2); }
  .viewswitch__btn { flex: 1 1 140px; justify-content: center; }
  .viewswitch__hint { flex-basis: 100%; }
}

.monthnav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.linkbtn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  max-width: 100%;
}

.linkbtn:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ================================================= Monatstabelle (Station) */

.mtwrap {
  overflow: auto;
  scrollbar-width: thin;
  max-height: min(72vh, 900px);
}

table.mt {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

table.mt th,
table.mt td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  text-align: center;
  vertical-align: middle;
}

table.mt th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  height: 46px;
}

table.mt th.mt__name,
table.mt td.mt__name {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 232px;
  min-width: 232px;
  text-align: left;
  padding: 7px var(--sp-4);
  background: var(--surface);
  border-right: 2px solid var(--line);
}

table.mt th.mt__name {
  z-index: 5;
  background: var(--surface-2);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

table.mt tbody tr:hover td { background: var(--surface-hover); }
table.mt tbody tr:hover td.mt__name { background: var(--surface-hover); }

.mt__day {
  display: block;
  font-size: 0.875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.15;
}

.mt__wd {
  display: block;
  font-size: 0.625rem;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

table.mt th.we,
table.mt td.we { background: var(--weekend-tint); }
table.mt th.obs,
table.mt td.obs { background: var(--obs-tint); }
table.mt th.hol,
table.mt td.hol { background: var(--holiday-tint); }
table.mt th.hol .mt__day { color: var(--warn); }
table.mt th.hol .mt__wd { color: var(--warn); font-weight: 700; }

table.mt th.bridge,
table.mt td.bridge {
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(45deg, var(--bridge-stripe) 0 2px, transparent 2px 6px);
}

table.mt th.bridge {
  box-shadow: inset 0 3px 0 var(--jet-yellow, #fbba00);
}

table.mt th.bridge .mt__day,
table.mt th.bridge .mt__wd { color: var(--bridge-ink); font-weight: 700; }

.mt__bridge {
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--bridge-ink);
  opacity: 0.7;
}

.mt__cell--free:hover .mt__bridge { opacity: 1; }

table.mt th.today {
  background: var(--accent);
}

table.mt th.today .mt__day,
table.mt th.today .mt__wd { color: #fff; }

table.mt td.today { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }

table.mt th.over {
  background: var(--danger);
}

table.mt th.over .mt__day,
table.mt th.over .mt__wd { color: #fff; }

table.mt td.over { background: var(--conflict-tint); }

.mt__namebtn {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
}

.mt__namebtn:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mt__cell {
  display: block;
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ink-3);
  transition: background-color 0.14s var(--ease), transform 0.12s var(--ease);
}

.mt__cell--free .mt__plus {
  opacity: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--primary);
  transition: opacity 0.14s var(--ease);
}

.mt__cell--free:hover {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.mt__cell--free:hover .mt__plus { opacity: 1; }

.mt__cell--abs {
  background: var(--mk, var(--t-urlaub));
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 12%, transparent);
}

.mt__cell--abs:hover { filter: brightness(1.1); }

.mt__cell--geplant {
  background: color-mix(in srgb, var(--mk) 24%, var(--surface));
  color: color-mix(in srgb, var(--mk) 82%, var(--ink));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mk) 55%, transparent);
}

.mt__cell--nocount {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.34) 0 3px,
    transparent 3px 7px
  );
  opacity: 0.72;
}

.mt__cell--conflict {
  box-shadow: inset 0 0 0 2px var(--danger);
}

.mt__sum { height: 38px; }

table.mt tfoot td {
  position: sticky;
  bottom: 0;
  background: var(--surface-2);
  border-top: 1px solid var(--line-2);
  z-index: 2;
}

table.mt tfoot td.mt__name { z-index: 4; }

.mt__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary-ink);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mt__count--over {
  background: var(--danger);
  color: #fff;
}

/* ============================================ Kalender (Mitarbeiter-Profil) */

.calyear {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: var(--sp-4);
}

.cal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-3);
  padding: 8px var(--sp-3);
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.cal__head:hover { background: var(--primary-soft); color: var(--primary-ink); }

.cal__badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--t-urlaub);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cal__wd,
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding: 0 6px;
}

.cal__wd {
  padding-top: 6px;
  font-size: 0.625rem;
  font-weight: 650;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.03em;
}

.cal__wd .we { color: var(--ink-3); opacity: 0.7; }

.cal__grid { padding-bottom: 6px; }

.cal__pad { aspect-ratio: 1; }

.cal__day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.1s var(--ease);
}

.cal__day:hover {
  border-color: var(--primary);
  transform: scale(1.06);
  z-index: 2;
}

.cal__day--we { background: var(--weekend-tint); color: var(--ink-3); }
.cal__day--obs { background: var(--obs-tint); color: var(--ink-2); box-shadow: inset 0 -2px 0 var(--obs-line); }
.cal__day--hol { background: var(--holiday-tint); color: var(--warn); font-weight: 700; }

.cal__day--bridge {
  background-color: var(--bridge-tint);
  background-image: repeating-linear-gradient(45deg, var(--bridge-stripe) 0 2px, transparent 2px 6px);
  color: var(--bridge-ink);
  font-weight: 700;
  border-color: color-mix(in srgb, var(--jet-yellow, #fbba00) 60%, transparent);
}

.cal__tag--hol { color: var(--warn); }
.cal__tag--obs { color: var(--ink-2); }
.cal__tag--bridge { color: var(--bridge-ink); }

.cal--big .cal__tag--hol,
.cal--big .cal__tag--obs,
.cal--big .cal__tag--bridge {
  font-size: 0.5625rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 3px;
}

.cal__day--today {
  box-shadow: 0 0 0 2px var(--accent);
  font-weight: 800;
}

.cal__day--abs {
  background: var(--mk, var(--t-urlaub));
  color: #fff;
  font-weight: 700;
}

.cal__day--geplant {
  background: color-mix(in srgb, var(--mk) 22%, var(--surface));
  color: color-mix(in srgb, var(--mk) 85%, var(--ink));
  border-color: color-mix(in srgb, var(--mk) 55%, transparent);
  border-style: dashed;
}

.cal__day--nocount {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.36) 0 3px,
    transparent 3px 7px
  );
  opacity: 0.75;
}

.cal__day--conflict { box-shadow: 0 0 0 2px var(--danger); }

/* „groß“ heißt gut lesbar, nicht bildschirmfüllend: feste Zellhöhe statt
   quadratischer Kacheln, damit der Monat kompakt bleibt. */
.cal--big {
  max-width: 560px;
  margin: 0;
}

.cal--big .cal__head { font-size: 0.9375rem; padding: 9px var(--sp-3); }
.cal--big .cal__wd { font-size: 0.6875rem; padding-top: 8px; }
.cal--big .cal__wd,
.cal--big .cal__grid { gap: 4px; padding-left: 8px; padding-right: 8px; }
.cal--big .cal__grid { padding-bottom: 10px; }
.cal--big .cal__pad { aspect-ratio: auto; height: 54px; }
.cal--big .cal__day {
  aspect-ratio: auto;
  height: 54px;
  border-radius: 7px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.cal--big .cal__num { font-size: 0.9375rem; font-weight: 600; }
.cal--big .cal__tag {
  font-size: 0.5625rem;
  font-weight: 700;
  opacity: 0.9;
  line-height: 1.1;
}

/* -------------------------------------------------------------- Profil */

.profile__avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--acc, var(--primary)) 16%, var(--surface));
  color: var(--acc, var(--primary));
  border: 1px solid color-mix(in srgb, var(--acc, var(--primary)) 35%, transparent);
  font-family: var(--font-head);
  font-size: 1.125rem;
  font-weight: 700;
  flex: none;
}

/* ------------------------------------------------------------- Vollbild */

html.maximized-lock,
html.maximized-lock body {
  overflow: hidden;
}

.maximized {
  position: fixed;
  inset: 0;
  z-index: 80;
  margin: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: maxin 0.24s var(--ease);
}

@keyframes maxin {
  from { opacity: 0.4; transform: scale(0.99); }
  to { opacity: 1; transform: none; }
}

.maximized .card__head {
  background: var(--surface);
  flex: none;
}

.maximized .gridscroll,
.maximized .mtwrap,
.maximized > .card__body {
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
}

.maximized .legend { flex: none; }
.maximized .calyear { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.gridsearch {
  min-height: 28px;
  font-size: 0.75rem;
  padding: 2px 8px;
  width: 100%;
}

.ghead__corner--filter { padding: 0 var(--sp-3); }

/* ---------------------------------------------------------------- Modal */

dialog.modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  max-width: min(560px, calc(100vw - 24px));
  width: 100%;
  max-height: calc(100dvh - 32px);
  overflow: visible;
}

dialog.modal--wide { max-width: min(760px, calc(100vw - 24px)); }

dialog.modal::backdrop {
  background: rgba(16, 14, 10, 0.5);
  backdrop-filter: blur(3px);
}

dialog.modal[open] {
  animation: pop 0.24s var(--ease);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.modal__head h2 { font-size: 1.0625rem; }
.modal__head small { color: var(--ink-3); font-size: 0.8125rem; }

.modal__body {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-height: min(66dvh, 620px);
  overflow: auto;
}

.modal__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-wrap: wrap;
}

.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-4);
}

.formgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.formgrid .span2 { grid-column: span 2; }

@media (max-width: 560px) {
  .formgrid,
  .formgrid--3 { grid-template-columns: minmax(0, 1fr); }
  .formgrid .span2 { grid-column: auto; }
}

/* Hinweis-Box */

.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.875rem;
}

.notice__icon { flex: none; margin-top: 1px; }
.notice__icon svg { width: 18px; height: 18px; }
.notice__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notice strong { font-size: 0.875rem; }

.notice--danger { border-color: var(--danger-line); background: var(--danger-soft); }
.notice--danger .notice__icon { color: var(--danger); }
.notice--warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.notice--warn .notice__icon { color: var(--warn); }
.notice--ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-soft); }
.notice--ok .notice__icon { color: var(--ok); }
.notice--info { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); background: var(--primary-soft); }
.notice--info .notice__icon { color: var(--primary); }

.overlaplist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.overlaplist div {
  font-size: 0.8125rem;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ------------------------------- Detail-Fenster hinter den Monatszahlen */

.detailgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: start;
}

.detailgrid__cal .cal--big { max-width: none; margin: 0; }
.detailgrid__cal .cal--big .cal__day { font-size: 0.875rem; }
.detailgrid__cal .cal--big .cal__num { font-size: 0.9375rem; }
.detailgrid__cal .cal--big .cal__head { font-size: 0.9375rem; padding: 9px var(--sp-3); }

.detailgrid__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}

@media (max-width: 720px) {
  .detailgrid { grid-template-columns: minmax(0, 1fr); }
}

/* Eintrag in der Liste */

.entryrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 8px var(--sp-3) 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.12s var(--ease);
}

.entryrow:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}

.entryrow__bar {
  width: 5px;
  align-self: stretch;
  flex: none;
  border-radius: 0 3px 3px 0;
}

.entryrow__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.entryrow__top {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.entryrow__top b { font-size: 0.875rem; font-weight: 600; }

.entryrow__dates {
  font-size: 0.875rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.entryrow__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.entryrow__days {
  flex: none;
  font-size: 0.75rem;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.entryrow__days b {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------------- Toasts */

.toasts {
  position: fixed;
  bottom: var(--sp-4);
  right: var(--sp-4);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: 11px var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  font-size: 0.875rem;
  animation: toastin 0.26s var(--ease);
}

.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast--ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.toast--ok svg { color: var(--ok); }
.toast--err { border-color: var(--danger-line); }
.toast--err svg { color: var(--danger); }
.toast--info svg { color: var(--primary); }
.toast.out { animation: toastout 0.2s var(--ease) forwards; }

@keyframes toastin {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes toastout {
  to { opacity: 0; transform: translateX(16px); }
}

/* ---------------------------------------------------------------- Login */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
}

.login__card {
  width: 100%;
  max-width: 396px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  animation: pop 0.4s var(--ease);
}

.login__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
}

.login__brand .brand__mark { width: 48px; height: 48px; border-radius: 13px; }
.login__brand .brand__mark svg { width: 25px; height: 25px; }
.login__brand h1 { font-size: 1.375rem; }
.login__brand p { color: var(--ink-2); font-size: 0.875rem; }

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar { display: none; }
  .railtoggle { display: none; } /* im Querformat-Menü nicht sinnvoll */
  .nav { flex-direction: row; gap: var(--sp-1); }
  .nav__label { display: none; }
  .nav a { min-height: 40px; padding: 0 var(--sp-3); white-space: nowrap; }
  .sidebar__foot { margin-top: 0; flex-direction: row; }
  .sidebar__foot .btn span { display: none; }
  .brand__text span { display: none; }
  .view { padding: var(--sp-4) var(--sp-3); }
  .topbar { padding: var(--sp-3); }
  /* schmaler Kopf: nur Name und „frei“ — die Zahl mit dem höchsten Wert */
  :root { --head-w: 208px; --rstat-w: 46px; }
  .rhead__stats .rstat:not(.rstat--free) { display: none; }
  .ghead__corner--labels .rstat:not(:last-child) { display: none; }
  .rhead__sub .meter { display: none; }
}

@media (max-width: 640px) {
  .kpi__value { font-size: 1.375rem; }
  .topbar__title h1 { font-size: 1rem; }
  .gridscroll { max-height: 68vh; }
}

@media print {
  .sidebar,
  .topbar,
  .toasts,
  .viewswitch,
  .station-tabs,
  .card__head .segmented,
  .card__head .btn,
  .monthnav {
    display: none !important;
  }

  .app { display: block; }
  .view { padding: 0; gap: 12px; }
  .gridscroll,
  .mtwrap,
  .tablewrap,
  .monthgrid {
    max-height: none;
    overflow: visible;
  }
  .card,
  .gridwrap { break-inside: avoid; box-shadow: none; }
  body {
    background: #fff;
    background-image: none;
    color: #000;
    font-size: 11px;
  }
  .kpi { break-inside: avoid; }
  @page { size: A4 landscape; margin: 10mm; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Handy-Ansicht
   --------------------------------------------------------------------------
   Am Rechner führt die Seitenleiste. Am Handy übernimmt eine Registerleiste
   unten — dort, wo der Daumen ist. Die Grenze 860px muss mit MOBILE_MAX in
   assets/js/ui.js übereinstimmen: das Skript entscheidet danach, ob ein Tipp
   auf ein Ortsschild direkt in die Tankstelle führt.
   ========================================================================== */

/* Am Rechner unsichtbar — die Elemente stehen trotzdem im HTML, damit das
   Umschalten beim Drehen des Geräts ohne Neuaufbau funktioniert. */
.tabbar,
.fab,
.topback,
.sign__go { display: none; }

@media (max-width: 860px) {
  :root {
    --tabbar-h: 58px;
    /* Höhe der Leiste plus Wischbalken — jede feste Ecke rechnet damit. */
    --tabbar-space: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  /* ---------------------------------------------------------------- Hülle */

  .sidebar { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }

  /* Kopfzeile: eine Zeile, Titel links, Jahr rechts. Kein Umbruch — sonst
     wächst die klebende Leiste und frisst den halben Bildschirm. */
  .topbar {
    min-height: 56px;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    padding-top: max(var(--sp-2), env(safe-area-inset-top, 0px));
    flex-wrap: nowrap;
  }

  .topbar__title h1 {
    font-size: 1.0625rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar__title small {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar .row { flex: none; gap: var(--sp-2); flex-wrap: nowrap; }

  /* Neues Jahr anlegen ist eine seltene Handlung und steht in den
     Einstellungen; „Urlaub eintragen" ist zum Schnellknopf gewandert. */
  #newYearBtn,
  #addAbsenceBtn { display: none; }

  .topbar .select {
    height: 40px;
    width: auto;
    min-width: 78px;
    padding-right: 26px;
    font-size: 0.875rem;
  }

  /* Zurück-Pfeil — nur auf Detailseiten, oberste Ebene braucht keinen */
  .topback {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    margin-left: -6px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .topback svg { width: 22px; height: 22px; }
  .topback:active { background: var(--surface-3); }

  /* display:grid oben würde das hidden-Attribut aushebeln */
  .topback[hidden] { display: none; }

  /* Unten liegen Registerleiste und Schnellknopf über dem Inhalt. Der
     Innenabstand hält die letzte Karte frei — sonst verschwindet sie darunter. */
  .view {
    padding: var(--sp-4) var(--sp-3);
    padding-bottom: calc(var(--tabbar-space) + 76px);
    gap: var(--sp-4);
  }

  /* ------------------------------------------------------ Registerleiste */

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: var(--tabbar-h);
    padding: 7px 2px 9px;
    color: var(--ink-3);
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .tab__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 26px;
    border-radius: 9px;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.14s var(--ease);
  }

  .tab__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tab[aria-current='page'] { color: var(--ink); }

  .tab[aria-current='page'] .tab__icon {
    background: var(--primary-soft);
    color: var(--primary-ink);
  }

  /* Gelber Strich oben — dieselbe Kennzeichnung wie in der Seitenleiste */
  .tab[aria-current='page']::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 28px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
    background: var(--jet-yellow, #fbba00);
  }

  .tab:active .tab__icon { transform: scale(0.9); }

  /* ------------------------------------------------------- Schnellknopf */

  .fab {
    position: fixed;
    right: var(--sp-4);
    bottom: calc(var(--tabbar-space) + var(--sp-4));
    z-index: 55;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: var(--jet-yellow, #fbba00);
    color: var(--jet-blue-dark, #0f2f6e);
    box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.14s var(--ease);
  }

  .fab svg { width: 26px; height: 26px; }
  .fab:active { transform: scale(0.94); }

  /* ---------------------------------------------------------- Startseite */

  .startblock { gap: var(--sp-3); }
  .startblock__head { align-items: flex-start; gap: var(--sp-2); }
  .startblock__head h2 { font-size: 1.0625rem; }
  .startblock__head .small { font-size: 0.75rem; }

  .signgrid { grid-template-columns: 1fr; gap: var(--sp-3); }

  /*
   * Das Ortsschild wird zur Zeile: Plakette oben, Kennzahlen darunter, alles
   * in einer Karte. Ein Tipp öffnet die Tankstelle — die beiden Knöpfe
   * darunter entfallen, der Schnellknopf deckt „Urlaub eintragen" ab.
   */
  .sign { align-items: stretch; }

  .sign__plate {
    gap: var(--sp-3);
    padding: 10px var(--sp-3);
    border-width: 2px;
    border-radius: 10px 10px 0 0;
    min-height: 60px;
  }

  .sign__plate:hover { transform: none; box-shadow: none; background: var(--plate); }
  .sign__icon { width: 34px; height: 34px; }
  .sign__icon svg { width: 21px; height: 21px; }
  .sign__name { font-size: 1.25rem; }

  .sign__go {
    display: grid;
    place-items: center;
    margin-left: auto;
    flex: none;
    opacity: 0.55;
  }

  .sign__post { display: none; }

  .sign__stats {
    justify-content: flex-start;
    gap: var(--sp-2);
    padding: 9px var(--sp-3);
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: var(--surface);
    font-size: 0.75rem;
  }

  .sign__actions { display: none; }

  /* Team-Listen: Name oben, Zahlen und Balken darunter in einer Zeile */
  .teamgroup { --team-name-w: auto; --team-indent: 26px; }

  .teamgroup__head { padding: var(--sp-3); gap: var(--sp-2); flex-wrap: wrap; }
  .teamgroup__title { flex: 1 1 auto; width: auto; min-width: 0; }
  .teamgroup__name { font-size: 0.9375rem; }
  .teamgroup__sums { gap: var(--sp-3); flex: none; }

  .teamrow {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px var(--sp-3);
    padding: 10px var(--sp-3) 11px calc(var(--sp-3) + var(--team-indent));
    min-height: 60px;
  }

  .teamrow__person { flex: 1 1 100%; width: auto; }
  .teamrow__name { font-size: 0.9375rem; }
  .teamrow__nums { gap: var(--sp-4); flex: none; }

  /* Der Balken bleibt sichtbar — er trägt die Beschriftung „21 von 34".
     Die Regel bei 900px blendet ihn aus, hier kommt er zurück. */
  .fillbar {
    display: block;
    flex: 1 1 110px;
    width: auto;
    min-width: 96px;
    height: 24px;
  }

  .teamrow__go { display: none; }

  .numblock { min-width: 44px; }
  .numblock b { font-size: 0.9375rem; }
  .numblock small { font-size: 0.5625rem; }

  /* ------------------------------------------------------ Tankstellen-Sicht */

  /* Stationswechsel als Streifen zum Wischen statt als Block über die
     halbe Seite. Randlos bis zum Bildschirmrand, damit klar ist: hier
     geht es seitwärts weiter. */
  .station-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-inline: calc(var(--sp-3) * -1);
    padding-inline: var(--sp-3);
    padding-bottom: 2px;
  }

  .station-tabs::-webkit-scrollbar { display: none; }

  .station-tab {
    flex: none;
    min-width: 190px;
    scroll-snap-align: start;
    padding: 8px 11px;
  }

  .station-tab__meta strong { font-size: 0.875rem; }
  .station-tab__meta span { display: none; }

  /* Kennzahlen als Streifen zum Wischen: eine Zeile statt fünf Kacheln
     untereinander. Randlos bis zum Bildschirmrand als Hinweis darauf,
     dass rechts noch etwas kommt. */
  .kpis {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 46vw;
    grid-template-columns: none;
    gap: var(--sp-2);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-inline: calc(var(--sp-3) * -1);
    padding-inline: var(--sp-3);
  }

  .kpis::-webkit-scrollbar { display: none; }

  .kpi {
    padding: 10px var(--sp-3);
    scroll-snap-align: start;
  }

  .kpi__value { font-size: 1.125rem; }

  /* Ansichtsumschalter: zwei gleich breite Flächen nebeneinander */
  .viewswitch {
    gap: var(--sp-2);
    padding: var(--sp-3);
    border-left-width: 3px;
  }

  /* Mit den kurzen Beschriftungen „Jahr" und „Monat" passt alles in
     eine Zeile — der Plan rückt dadurch einen Bildschirm weiter nach oben. */
  .viewswitch__label { flex: none; }
  .viewswitch__group { flex: 1 1 auto; min-width: 0; gap: var(--sp-2); flex-wrap: nowrap; }

  .viewswitch__btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 0 var(--sp-2);
    font-size: 0.875rem;
    text-align: center;
  }

  .viewswitch__btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .viewswitch__hint { flex: 1 1 100%; font-size: 0.6875rem; }

  /* -------------------------------------------------------- Monatsplan */

  /* Pfeil, Monatsstreifen, Pfeil — eine Zeile. Die Monate lassen sich
     wischen, statt in drei Reihen umzubrechen. */
  .monthnav { flex-wrap: nowrap; width: 100%; }

  .monthnav .segmented {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .monthnav .segmented::-webkit-scrollbar { display: none; }

  .monthnav .segmented button {
    flex: none;
    scroll-snap-align: center;
    padding: 7px 12px;
  }

  .card__head { padding: var(--sp-3); gap: var(--sp-3); }
  .card__head h2 { font-size: 1.0625rem; }
  .card__body { padding: var(--sp-3); }

  /*
   * Namensspalte schmaler, Tagesspalten breiter: auf 375px blieben sonst
   * vom Monat nur fünf Tage sichtbar. Die Tabelle scrollt seitwärts —
   * senkrecht wächst sie mit der Seite, damit es kein Feld im Feld gibt.
   */
  .mtwrap { max-height: none; }

  table.mt { min-width: 1150px; }

  table.mt th.mt__name,
  table.mt td.mt__name {
    width: 128px;
    min-width: 128px;
    padding: 6px var(--sp-2);
  }

  .mt__namebtn { font-size: 0.8125rem; line-height: 1.25; }

  .mt__meta { flex-wrap: nowrap; gap: 5px; align-items: center; }
  .mt__meta-month { display: none; }
  .mt__meta-free { white-space: nowrap; font-size: 0.625rem; }
  .mt__meta .chip { padding: 1px 5px; font-size: 0.5625rem; }

  /* Jahresraster: ebenfalls kein zweites Scrollfeld in der Seite */
  .gridscroll { max-height: 62vh; }

  /* -------------------------------------------------- Gesamtübersicht */

  /*
   * Die vier Zahlen sind der Grund, warum diese Seite existiert — sie
   * müssen ohne Wischen zu sehen sein. 118 + 4×50 = 318px und damit
   * innerhalb der 375px eines kleinen Telefons.
   */
  .lg {
    --lg-name: 118px;
    --lg-num: 50px;
    font-size: 0.8125rem;
  }

  /*
   * Ohne Monatsverlauf werden die Spaltenbreiten fest vergeben. Sonst
   * verteilt der Browser sie nach Inhalt, die Namensspalte wächst auf 260px
   * und die Zahlen rutschen aus dem Bild. Mit Monatsverlauf bleibt es beim
   * Verteilen nach Inhalt — dort wird ohnehin gewischt.
   */
  /* Weiter oben steht min-width: min(100%, 780px) — daran scheitert jede
     schmalere Aufteilung. Am Handy zählt die Bildschirmbreite. */
  table.lg.lg--nomonths {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
  }

  /* Ohne Monatsverlauf gelten weiter oben 42% Breite und min-width: 260px.
     Beides muss hier weg, sonst füllt allein die Namensspalte den Schirm.
     Bewusst hohe Genauigkeit im Selektor, damit nichts dazwischenfunkt. */
  /* Die vier Zahlenspalten bekommen feste 48px, die Namensspalte den Rest.
     So passt die Tabelle auf jedes Telefon — von 320px aufwärts — ohne
     seitliches Wischen, und je breiter das Gerät, desto mehr Platz für
     die Namen. */
  table.lg.lg--nomonths th.lg__name,
  table.lg.lg--nomonths td.lg__name {
    width: auto;
    min-width: 0;
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table.lg.lg--nomonths th.lg__num,
  table.lg.lg--nomonths td.lg__num {
    width: 48px;
    min-width: 0;
    max-width: 48px;
    padding-left: 2px;
    padding-right: 2px;
  }

  /* Namen umbrechen statt abschneiden — „Markus Fel…" hilft niemandem.
     Die Einrückung stammt aus der Tablet-Regel und kostet zu viel Platz. */
  .lg__person { padding-left: 10px; gap: 3px; }
  .lg__personname { white-space: normal; overflow: visible; text-overflow: clip; }
  .lg__stationname { white-space: normal; }
  .lg__toggle { width: 22px; }
  .lg__personhead { gap: 5px; flex-wrap: wrap; }

  .lg thead th { padding: 7px 4px; font-size: 0.5625rem; letter-spacing: 0.02em; }
  .lg thead th small { font-size: 0.5rem; }
  .lg thead .lg__name { padding-left: var(--sp-3); }
  .lg .lg__name { padding: 6px var(--sp-2); }
  .lg .lg__num { padding: 5px 4px; }
  .lg__legend { font-size: 0.6875rem; }

  /* --------------------------------------------------- Mitarbeiterprofil */

  .profile__back { display: none; }

  /* ----------------------------------------------------------- Dialoge */

  /* Formulare als Blatt von unten — die vertraute Geste am Handy. */
  .modal {
    width: 100%;
    max-width: none;
    margin: auto auto 0;
    border-radius: 18px 18px 0 0;
    max-height: 92dvh;
  }

  .modal__foot { padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom, 0px)); }

  /* Auf Handys zoomt iOS bei Schriftgrößen unter 16px in das Feld hinein. */
  .input,
  .select,
  textarea { font-size: 16px; }

  /* Fingerfreundliche Mindesthöhe für alles, was angetippt wird */
  .btn { min-height: 44px; }
  .btn--sm { min-height: 38px; }

  .toasts { bottom: calc(var(--tabbar-space) + 76px); }
}
