/* =========================================================
   PEPP — App Stylesheet (shared across all PEPP_html screens)
   Brings the app to the visual standard of pepp-landing.

   Warm Editorial: Fraunces (headlines) + DM Sans (body)
   Palette: coral #EB7556 · cream #FFF1AB · charcoal #2B2929 · white

   Token architecture (3 layers):
     1. Brand primitives  — what colors/fonts look like ("coral", "cream")
     2. Semantic tokens   — what they mean for the UI ("primary", "text")
     3. Component styles  — use only semantic tokens, never primitives
   To rebrand: change layer 1. Layers 2 + 3 update automatically.
   ========================================================= */

:root {
  /* ============ 1. BRAND PRIMITIVES ============ */
  /* Colors as they appear in the brand kit */
  --coral:      #EB7556;
  --coral-tint: #F4B6A6;
  --coral-mute: #FAD9D1;
  --coral-soft: #FFF1EC;
  --coral-deep: #e1623f;   /* hover state of coral */

  --cream:      #FFF1AB;
  --cream-soft: #FFFBE0;

  --ink:        #2B2929;
  --ink-soft:   #5c5856;
  --ink-faint:  #8a8584;
  --ink-deep:   #1f1d1d;
  --ink-darkest:#1a1818;   /* footer / dark sections */

  --white:      #ffffff;
  --line:       #ece8e5;

  /* Functional primitives */
  --red:        #dc3545;
  --red-soft:   rgba(220, 53, 69, 0.12);
  --amber:      #b58200;   /* warning text on light bg */
  --amber-soft: #fff3cd;
  --green:      #28a745;
  --green-soft: #d4edda;

  /* Fonts */
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ============ 2. SEMANTIC TOKENS ============ */
  /* Colors by role — what they mean in the UI */

  /* Surfaces (backgrounds) */
  --color-bg:            var(--cream-soft);  /* warm app canvas */
  --color-surface:       var(--white);
  --color-surface-alt:   var(--cream-soft);
  --color-surface-tint:  var(--coral-soft);
  --color-overlay-dark:  linear-gradient(160deg, var(--ink) 0%, var(--ink-deep) 100%);

  /* Text */
  --color-text:            var(--ink);
  --color-text-muted:      var(--ink-soft);
  --color-text-faint:      var(--ink-faint);
  --color-text-on-dark:    rgba(255, 255, 255, 0.78);
  --color-text-on-primary: var(--white);

  /* Brand / interaction */
  --color-primary:       var(--coral);
  --color-primary-hover: var(--coral-deep);
  --color-primary-soft:  var(--coral-soft);
  --color-accent:        var(--coral);
  --color-highlight:     var(--coral);

  /* Borders, lines */
  --color-border:       var(--line);
  --color-border-hover: var(--coral-tint);

  /* Status */
  --color-success:      var(--green);
  --color-success-soft: var(--green-soft);
  --color-warning:      var(--amber);
  --color-warning-soft: var(--amber-soft);
  --color-error:        var(--red);
  --color-error-soft:   var(--red-soft);
  --color-info:         var(--coral);
  --color-focus-ring:   rgba(235, 117, 86, 0.15);

  /* ============ SPACING SCALE (4px base) ============ */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ============ TYPE SCALE ============ */
  --text-hero:    clamp(2.5rem, 6vw, 4.5rem);
  --text-h2:      clamp(1.9rem, 4.2vw, 2.9rem);
  --text-h3:      1.25rem;
  --text-lead:    clamp(1.15rem, 2.2vw, 1.4rem);
  --text-body:    1.0625rem;
  --text-sub:     1.1rem;
  --text-small:   0.9rem;
  --text-xs:      0.82rem;
  --text-eyebrow: 0.8rem;

  /* ============ LAYOUT ============ */
  --maxw:        1100px;
  --maxw-narrow: 720px;
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-pill: 999px;

  /* ============ SHADOWS ============ */
  --shadow-sm:       0 2px 8px rgba(43, 41, 41, 0.04);
  --shadow-md:       0 10px 30px rgba(43, 41, 41, 0.08);
  --shadow-lg:       0 20px 50px rgba(43, 41, 41, 0.12);
  --shadow-primary:  0 6px 18px rgba(235, 117, 86, 0.32);

  /* ============ MOTION ============ */
  --ease:     cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 0.15s;
  --dur:      0.22s;
  --dur-slow: 0.6s;
}

/* =========================================================
   DARK MODE (Layer 2 überschreiben, Layer 1/3 unangetastet)
   Aktiviert via <html data-theme="dark">. Die Papier-PEP-
   Dienstplantabelle (.excel-*) bleibt hell als helle Insel —
   Wiedererkennungswert hat Vorrang vor Dark-Anpassung.
   ========================================================= */
html[data-theme="dark"] {
  --color-bg:           #1a1818;
  --color-surface:      #252323;
  --color-surface-alt:  #1f1d1d;
  --color-surface-tint: #2e2a2a;
  --color-overlay-dark: linear-gradient(160deg, #0f0e0e 0%, #1a1818 100%);

  --color-text:            #f0ece9;
  --color-text-muted:      #b5b0ad;
  --color-text-faint:      #8a8584;
  --color-text-on-dark:    rgba(255, 255, 255, 0.92);
  --color-text-on-primary: var(--white);

  --color-primary-soft:  rgba(235, 117, 86, 0.18);
  --color-border:        #3a3636;
  --color-border-hover:  var(--coral-tint);

  --color-success-soft:  rgba(40, 167, 69, 0.18);
  --color-warning-soft:  rgba(181, 130, 0, 0.18);
  --color-error-soft:    rgba(220, 53, 69, 0.20);
  --color-info:          var(--coral);
  --color-focus-ring:    rgba(235, 117, 86, 0.30);

  --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-md:       0 10px 30px rgba(0, 0, 0, 0.40);
  --shadow-lg:       0 20px 50px rgba(0, 0, 0, 0.50);

  /* Excel-Tabelle bleibt hell (Insel) → Standard-Werte beibehalten */
}

/* Im Dark Mode: Tabelle/Inputs passen sich an (außer .excel-*) */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--color-surface-alt);
  color: var(--color-text);
}
html[data-theme="dark"] th {
  background: var(--color-surface-tint);
}
html[data-theme="dark"] tbody tr:hover {
  background: var(--color-surface-tint);
}
/* Sticky Header im Dark Mode dunkler */
html[data-theme="dark"] .site-header {
  background: rgba(37, 35, 35, 0.85);
}

/* Theme-Toggle im Header */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Im Light Mode den Mond zeigen, im Dark Mode die Sonne (zum Zurückschalten) */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  padding: var(--space-6);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  color: var(--color-text);
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: var(--text-h3); }

p { margin: 0 0 var(--space-4); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

strong { font-weight: 700; }
small { font-size: var(--text-small); }

/* Coral highlight used inline in headings */
.hl {
  color: var(--color-highlight);
  font-weight: 600;
}

/* Eyebrow label above section titles */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-eyebrow);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 var(--space-4);
}

/* Focus visibility for keyboard users */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--space-1);
}

/* =========================================================
   HEADER (app top bar — used on tool screens + portal)
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-6);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 64px;
  padding: 0 var(--space-6);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-right: auto;
  line-height: 0;
}
.wordmark:hover { text-decoration: none; }
.logo {
  height: 30px;
  width: auto;
  max-width: 100%;
  display: block;
  /* Stabiles Seitenverhältnis verhindert Layout-Shift beim Laden
     (Bild ist 1692x438 ≈ 3.86:1). Verzerrung/Flackern durch das
     ursprüngliche width/height-Attribut wird so ausgeglichen. */
  aspect-ratio: 1692 / 438;
  object-fit: contain;
}
.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.nav-links a {
  color: var(--color-text);
  font-size: 0.97rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.nav-links a:hover { color: var(--color-primary); text-decoration: none; }
.nav-links a:hover::after { transform: scaleX(1); }

/* =========================================================
   SURFACE CARDS / PAGE SHELLS
   ========================================================= */
.app-container,
.dashboard,
.card,
.hub-container {
  background: var(--color-surface);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  max-width: 880px;
  margin: 0 auto;
}

/* Width helpers — override the default 880px */
.dashboard       { max-width: 920px; }                 /* admin / chefin */
.app-container   { max-width: 760px; }                 /* persoenlicher / wuensche */
.hub-container   { max-width: 620px; text-align: center; }
.login-box       { max-width: 420px; margin-inline: auto; text-align: center; }
.card            { max-width: 760px; }

/* Compact login dashboard variant */
.dashboard.login-box { padding: var(--space-10) var(--space-8); }

/* Reset default body padding when a header is present */
body.has-header { padding-top: 0; }

/* =========================================================
   BUTTONS
   All pill-shaped, weight 700, lift -2px on hover.
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 0.6em 1.25em;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur) var(--ease),
              background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
  background: var(--color-border);
  color: var(--color-text-faint);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-block { width: 100%; }
.btn-lg { font-size: var(--text-sub); padding: 0.75em 1.5em; }
.btn-sm { font-size: 0.85rem; padding: 0.6em 1em; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-on-primary);
}

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

.btn-success { background: var(--color-success); color: var(--white); }
.btn-success:hover { background: #218838; color: var(--white); }

.btn-warning { background: var(--amber); color: var(--white); }
.btn-warning:hover { background: #8a6200; color: var(--white); }

.btn-danger { background: var(--color-error); color: var(--white); }
.btn-danger:hover { background: #b02a37; color: var(--white); }

/* Legacy button class names used throughout the app JS.
   These map onto the brand button system so markup/JS is untouched. */
button:not([class]) {
  /* default <button> (no class) → brand primary, full-width block.
     Keeps every existing onclick="..." working.
     NOTE: a plain `button` selector would clobber .tab-btn/.btn-success/etc.
     `:not([class])` matches only truly classless buttons (login, generierePlan…)
     so every variant button renders by its own rule. */
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.97rem;
  line-height: 1.1;
  padding: 0.6em 1.25em;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  margin-block: var(--space-3);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  box-shadow: var(--shadow-primary);
  transition: transform var(--dur) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
button:not([class]):hover {
  transform: translateY(-2px);
  background: var(--color-primary-hover);
}
button:not([class]):disabled {
  background: var(--color-border);
  color: var(--color-text-faint);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Legacy variant classes → semantic buttons (keep old class names so JS strings compile) */
.btn-logout { background: transparent; color: var(--color-error); border-color: var(--color-error); width: auto; box-shadow: none; }
.btn-logout:hover { background: var(--color-error); color: var(--white); transform: translateY(-2px); }
.btn-small { background: transparent; color: var(--color-text); border-color: var(--color-border); width: auto; padding: 0.55em 1em; font-size: 0.88rem; font-weight: 600; box-shadow: none; }
.btn-small:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-publish { background: var(--color-success); color: var(--white); box-shadow: 0 6px 18px rgba(40, 167, 69, 0.28); }
.btn-publish:hover { background: #218838; color: var(--white); }
.btn-cleanup { background: var(--color-warning); color: var(--white); }
.btn-cleanup:hover { background: #8a6200; color: var(--white); }
.btn-action { width: 100%; margin-top: var(--space-3); font-size: 0.92rem; }
.btn-action.take { background: var(--color-success); color: var(--white); box-shadow: 0 6px 18px rgba(40, 167, 69, 0.28); }
.btn-action.take:hover { background: #218838; }
.btn-delete { background: transparent; color: var(--color-error); border: 1px solid var(--color-error); width: auto; font-size: 0.8rem; padding: 0.5em 0.9em; box-shadow: none; margin: 0; }
.btn-delete:hover { background: var(--color-error); color: var(--white); }

/* =========================================================
   FORMS
   ========================================================= */
.form-group { margin-bottom: var(--space-4); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
}
input, select, textarea {
  width: 100%;
  padding: 0.7em 0.85em;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--color-text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}
textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; }

/* =========================================================
   STAT CARDS (Zeitkonto dashboard)
   ========================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: var(--color-surface-tint);
  padding: var(--space-4);
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--color-border);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-1);
  line-height: 1.1;
}
.stat-value.negative { color: var(--color-error); }
.stat-value.positive { color: var(--color-success); }

/* =========================================================
   DASHBOARD TILES (Chefin-Dashboard: Kachel-Übersicht + Views)
   Wiederverwendet .dashboard-grid/.stat-card für KPIs oben.
   ========================================================= */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.dash-header h1 { margin: 0; }
.dash-header .btn-logout { margin-top: 0; } /* überschreibt den -3.5rem-Trick */

.dash-view { animation: dashFade var(--dur) var(--ease); }
.dash-view.is-hidden { display: none; }
@keyframes dashFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}
.dash-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.dash-tile:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}
.dash-tile .dash-tile-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: var(--radius);
  margin-bottom: var(--space-1);
}
.dash-tile .dash-tile-icon svg { width: 22px; height: 22px; }
.dash-tile .dash-tile-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
}
.dash-tile .dash-tile-desc {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  margin: 0;
}
.dash-tile-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 0.5em;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-radius: var(--radius-pill);
  font-size: 0.8rem; font-weight: 700;
  margin-left: auto;
}
.dash-tile-count.zero { background: var(--color-border); color: var(--color-text-faint); }

.back-link {
  display: inline-flex; align-items: center; gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.92rem; font-weight: 600;
  text-decoration: none;
  margin-bottom: var(--space-5);
  cursor: pointer;
  background: none; border: none; padding: 0;
  font-family: inherit;
}
.back-link:hover { color: var(--color-primary); }

/* Utility: volle Formular-Spalte (für Wochenmuster / Bereiche) */
.form-grid-full { grid-column: 1 / -1; }

/* =========================================================
   SIDEBAR-LAYOUT (Admin-Shell: Sidebar + Main)
   Chefin-Dashboard und Admin nutzen eine persistente linke
   Navigation. Mobile: Drawer + Hamburger.
   ========================================================= */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 80px; /* unter dem Site-Header */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar-title {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin: var(--space-3) var(--space-2) var(--space-1);
}
.sidebar-title:first-child { margin-top: 0; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6em 0.85em;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.sidebar-link:hover { background: var(--color-surface-tint); color: var(--color-text); }
.sidebar-link.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link .count-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1em 0.5em;
  border-radius: var(--radius-pill);
  min-width: 20px;
  text-align: center;
}
.sidebar-link .count-badge.zero { background: var(--color-border); color: var(--color-text-faint); }
.sidebar-main { min-width: 0; /* verhindert Grid-Overflow */ }

/* Sidebar im Dashboard-Layout verankern */
.app-shell > .dashboard {
  max-width: none;
  margin: 0;
  width: 100%;
}

/* Mobile: Sidebar wird Drawer */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 41, 41, 0.5);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop { display: none; }
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.sidebar-toggle svg { width: 22px; height: 22px; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    max-height: 100vh;
    width: 260px;
    border-radius: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    padding-top: var(--space-6);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-open ~ .sidebar-overlay { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-main { width: 100%; }
}

/* =========================================================
   TABS
   ========================================================= */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-6);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 0.8em;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  border: 0;
  background: transparent;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--color-primary); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Secondary tab-bar variant (admin: Ansicht / Bearbeiten) */
.tab-bar { display: flex; gap: var(--space-2); margin: var(--space-4) 0; }
.tab-btn {
  background: transparent;
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
  padding: 0.6em 1.1em;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  margin: 0;
  box-shadow: none;
  transition: all var(--dur-fast) var(--ease);
}
.tab-btn:hover { border-color: var(--color-primary); color: var(--color-primary); transform: none; background: transparent; }
.tab-btn.active {
  background: var(--color-primary);
  color: var(--white);
  border-color: var(--color-primary);
}

/* =========================================================
   SHIFT / WUNSCH CARDS
   ========================================================= */
.schicht-liste { display: flex; flex-direction: column; gap: var(--space-3); }
.schicht-card {
  background: var(--color-surface-tint);
  border-left: 5px solid var(--color-primary);
  padding: var(--space-4);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.schicht-card.is-pending { border-left-color: var(--color-warning); }
.schicht-header { display: flex; justify-content: space-between; align-items: center; }
.datum { font-weight: 700; font-size: 1.05rem; }
.wochentag {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.zeit {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--color-surface);
  padding: 0.3em 0.7em;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.wunsch-liste {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  max-height: 420px;
  overflow-y: auto;
  padding-right: var(--space-1);
}
.wunsch-card {
  background: var(--color-warning-soft);
  border-left: 5px solid var(--color-warning);
  padding: var(--space-4);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.wunsch-info { flex: 1; }
.wunsch-info .datum { margin-bottom: var(--space-1); }
.wunsch-info .typ {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.2em 0.6em;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: var(--space-1);
  border: 1px solid var(--color-border);
}
.wunsch-info .grund { font-size: 0.85rem; color: var(--color-text-muted); margin-top: var(--space-1); font-style: italic; }
.wunsch-card.is-past { border-left-color: var(--color-text-faint); }
.wunsch-card .typ .badge { font-size: 0.78rem; }

/* =========================================================
   STATUS / BADGES
   ========================================================= */
.status-msg {
  margin-top: var(--space-3);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: center;
  padding: var(--space-3);
  border-radius: var(--radius);
}
.status-msg.success { color: var(--color-success); background: var(--color-success-soft); border: 1px solid #b1dfbb; }
.status-msg.error   { color: #721c24; background: var(--color-error-soft); border: 1px solid #f5c6cb; }
.success { color: var(--color-success); }
.error   { color: var(--color-error); }

.alert-box {
  background: var(--color-warning-soft);
  border-left: 5px solid var(--color-warning);
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
}
.info-text { color: var(--color-text-muted); font-size: 0.92rem; margin-bottom: var(--space-5); line-height: 1.55; }
.empty-state {
  text-align: center;
  color: var(--color-text-faint);
  font-style: italic;
  padding: var(--space-5);
  background: var(--color-surface-tint);
  border-radius: var(--radius);
}

/* Status badges — replace inline-styled <span> in JS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3em 0.6em;
  border-radius: var(--radius-sm);
  line-height: 1.2;
  white-space: nowrap;
}
.badge-gleitzeit { background: var(--coral-mute); color: var(--color-primary); }
.badge-angefragt { background: var(--color-primary-soft); color: var(--color-primary); }
.badge-aufboerse { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-sperre   { background: var(--color-error-soft); color: var(--color-error); }
.badge-ja       { color: var(--color-success); font-weight: 700; }
.badge-nein     { color: var(--color-warning); font-weight: 700; }

/* =========================================================
   TABLES (admin team list, approval lists — NOT the schedule)
   ========================================================= */
table { width: 100%; border-collapse: collapse; margin-top: var(--space-4); font-size: 0.92rem; }
th, td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: middle; }
th {
  background: var(--color-surface-tint);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
tbody tr { transition: background var(--dur-fast) var(--ease); }
tbody tr:hover { background: var(--color-surface-tint); }
tbody tr.row-sperre { background: var(--color-error-soft); }
tbody tr.row-sperre:hover { background: rgba(220, 53, 69, 0.18); }

/* =========================================================
   CUSTOM MODAL (replaces alert/confirm)
   ========================================================= */
#custom-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 41, 41, 0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: var(--space-4);
}
#custom-modal.is-open { display: flex; }
.modal-content {
  background: var(--color-surface);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
#custom-modal-text { font-size: 1rem; margin-bottom: var(--space-5); line-height: 1.55; white-space: pre-wrap; color: var(--color-text); }
#custom-modal-buttons { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* =========================================================
   LAYOUT HELPERS
   ========================================================= */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.section-title { font-size: var(--text-h2); margin-bottom: 0.4em; }
.section-sub { font-size: var(--text-sub); color: var(--color-text-muted); max-width: 56ch; }

.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { margin-top: var(--space-6); }
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.float-right { float: right; }

/* =========================================================
   PORTAL (index.html) — feature cards
   ========================================================= */
.portal-hero { text-align: center; margin-bottom: var(--space-10); }
.portal-hero .hero-title { font-size: var(--text-hero); margin-bottom: 0.3em; }
.portal-hero .hero-sub { font-size: var(--text-lead); color: var(--color-text-muted); max-width: 42ch; margin-inline: auto; }

.portal-section-title {
  margin: var(--space-10) 0 var(--space-4);
  font-size: 0.78rem;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
  font-family: var(--font-body);
  font-weight: 700;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.feature-card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  gap: var(--space-3);
  cursor: pointer;
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.feature-card-link:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.feature-card-link .feature-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: var(--radius);
}
.feature-card-link .icon { width: 26px; height: 26px; }
.feature-card-link .title { font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; }
.feature-card-link .desc { font-size: 0.92rem; color: var(--color-text-muted); margin: 0; }

/* =========================================================
   LOG CONSOLE (mobile.html, import_tool.html)
   On-brand dark console: ink-darkest bg, muted green/coral mono text
   ========================================================= */
.log-fenster, #log.log-console {
  background: var(--ink-darkest);
  color: #6ee7a8;
  font-family: "Menlo", "SF Mono", Consolas, monospace;
  padding: var(--space-4);
  border-radius: var(--radius);
  height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.55;
  border: 1px solid var(--ink-deep);
}
#log.log-console .warn { color: var(--coral-tint); }
#log.log-console .err  { color: #ff8a76; }
#log.log-console .ok   { color: #7fd99b; }

/* =========================================================
   PAPER-SLIP SCHEDULE TABLE — PRESERVED VERBATIM
   These .excel-* rules reproduce the look of the old paper PEP
   slips / Excel exports for Wiedererkennungswert (recognition
   value). DO NOT retune — the shift-cell colors below are the
   documented "blue = work, green = vacation/sick" convention.
   (Source: admin.html & persoenlicher_plan.html <style> blocks.)
   ========================================================= */
.excel-container { overflow-x: auto; background: var(--color-surface); margin-top: var(--space-4); }
.excel-table {
  border-collapse: collapse;
  width: max-content;
  font-family: "Calibri", "Segoe UI", Arial, sans-serif;
  font-size: 12.5px;
}
.excel-table td {
  border: 1px solid #d4d4d4;
  padding: 4px 6px;
  text-align: center;
  color: #000;
}
.excel-title-row td {
  border: none;
  font-size: 18px;
  font-weight: bold;
  text-align: left;
  color: var(--excel-titelzeile, #107c41);
  padding: 5px 0;
}
.excel-subtitle-row td {
  border: none;
  font-size: 14px;
  text-align: left;
  padding-bottom: 15px;
  color: #555;
}
.excel-header-row td {
  background-color: var(--excel-header, #f3f2f1);
  font-weight: bold;
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}
.excel-name-col {
  text-align: left !important;
  font-weight: bold;
  background-color: var(--excel-namecol, #f9f9f9);
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 2px solid #000 !important;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
.excel-highlight-row td { background-color: #e6f2ff !important; }
.excel-sum-col {
  font-weight: bold;
  background-color: var(--excel-namecol, #f9f9f9);
  border-left: 2px solid #000 !important;
}
.excel-name-end {
  text-align: left !important;
  background-color: var(--excel-namecol, #f9f9f9);
  border-left: 2px solid #000 !important;
}

/* Legacy admin plan-table wrapper (editor) — keep its framing on-brand */
.pep-tabelle { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 700px; }
.pep-tabelle th, .pep-tabelle td { border: 1px solid var(--color-border); padding: 6px 2px; text-align: center; }
.pep-tabelle th { background-color: var(--color-surface-tint); font-weight: bold; font-size: 0.72rem; }
.pep-tabelle td:first-child, .pep-tabelle th:first-child { position: sticky; left: 0; background-color: var(--color-surface); z-index: 2; text-align: left; padding-left: 10px; box-shadow: 2px 0 4px rgba(0,0,0,0.05); }
.pep-tabelle th:first-child { z-index: 3; background-color: var(--color-surface-tint); }
.wochenende { background-color: #fcfcfc; }

/* Schedule legend — preserved as-is */
.legende { margin-top: var(--space-4); font-size: 0.78rem; color: var(--color-text-muted); display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; }
.legende .farb-feld { display: inline-block; width: 14px; height: 14px; border: 1px solid #999; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.legende-item { display: inline-flex; align-items: center; gap: 2px; }

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 880px) {
  .portal-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  body { padding: var(--space-4); font-size: 1rem; }
  .app-container, .dashboard, .card, .hub-container { padding: var(--space-5); }
  .portal-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-tiles { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; }
  .dash-header .btn-logout { align-self: flex-start; }
  .nav-links { display: none; }
}
