:root {
  --brand-orange: #e85d04;
  --brand-orange-hover: #d45304;
  --brand-black: #0d0d0d;
  --brand-gray-900: #1a1a1a;
  --brand-gray-600: #666;
  --brand-gray-400: #999;
  --brand-gray-200: #e8e8e8;
  --brand-gray-100: #f4f4f4;
  --brand-white: #fff;
  --brand-radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--brand-gray-100); color: var(--brand-gray-900); line-height: 1.5; }
a { color: var(--brand-orange); text-decoration: none; }
a:hover { color: var(--brand-orange-hover); text-decoration: underline; }

/* Login */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; background: var(--brand-black); }
.login-brand { text-align: center; margin-bottom: 1.5rem; width: 100%; max-width: 420px; }
.login-card { width: 100%; max-width: 420px; padding: 2rem; border: none; box-shadow: 0 4px 24px rgb(0 0 0 / 0.25); border-radius: var(--brand-radius); }
.login-card h1 { text-align: center; font-size: 1.25rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--brand-black); }
.subtitle { color: var(--brand-gray-600); margin-bottom: 1.5rem; text-align: center; font-size: 0.9rem; }

/* Logo */
.app-logo { display: block; height: auto; object-fit: contain; }
.app-logo--sidebar { width: 100%; max-width: 200px; }
.app-logo--login { width: 100%; max-width: 300px; margin: 0 auto; }
.app-logo--topbar { display: none; height: 36px; width: auto; max-width: 140px; }
.sidebar-logo-link { display: block; text-decoration: none; line-height: 0; }
.sidebar-tagline { display: block; margin-top: 0.5rem; font-size: 0.7rem; color: var(--brand-gray-400); letter-spacing: 0.06em; text-transform: uppercase; }
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.topbar-left h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--brand-black); color: var(--brand-white); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 1.25rem 1rem; border-bottom: 1px solid #2a2a2a; }
.sidebar nav { padding: 1rem; flex: 1; }
.nav-section { margin-bottom: 0.75rem; }
.nav-section + .nav-section { padding-top: 0.75rem; border-top: 1px solid #333; }
.nav-section-label {
    padding: 0.15rem 0.75rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #888;
}
.sidebar nav a { display: block; padding: 0.6rem 0.75rem; color: #ccc; border-radius: var(--brand-radius); margin-bottom: 0.25rem; text-decoration: none; font-size: 0.9rem; transition: background 0.15s, color 0.15s; }
.sidebar nav a:hover { background: #222; color: var(--brand-white); text-decoration: none; }
.sidebar nav a.active { background: var(--brand-orange); color: var(--brand-white); }
.sidebar-footer { padding: 1rem; border-top: 1px solid #2a2a2a; font-size: 0.875rem; }
.sidebar-footer a { color: var(--brand-gray-400); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--brand-white); border-bottom: 1px solid var(--brand-gray-200); padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 20; overflow: visible; }
.topbar h1 { font-size: 1.15rem; font-weight: 600; color: var(--brand-black); }
.content { padding: 1.5rem; flex: 1; }

/* Cards */
.card { background: var(--brand-white); border: 1px solid var(--brand-gray-200); border-radius: var(--brand-radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: none; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid #e2e8f0; }
.card-link { display: block; color: inherit; text-decoration: none; transition: box-shadow 0.15s; }
.card-link:hover { box-shadow: 0 4px 12px rgb(0 0 0 / 0.08); text-decoration: none; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; }
.card-footer { display: flex; justify-content: space-between; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #f1f5f9; font-size: 0.875rem; }
.empty-card { text-align: center; color: #64748b; padding: 3rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label, .form-group > label { display: block; font-size: 0.875rem; font-weight: 500; color: #475569; margin-bottom: 0.35rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 8px; font: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: 2px solid var(--brand-orange);
  outline-offset: -1px;
  border-color: var(--brand-orange);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.span-2 { grid-column: span 2; }
.form-card h2 { margin: 1.5rem 0 1rem; font-size: 1.1rem; }
.form-card h2:first-child { margin-top: 0; }
.form-actions, .btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.form-inline { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.inline { display: inline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1.1rem; border-radius: var(--brand-radius); font-weight: 600; border: none; cursor: pointer; font: inherit; text-decoration: none; transition: background 0.15s; }
.btn-primary { background: var(--brand-orange); color: var(--brand-white); }
.btn-primary:hover { background: var(--brand-orange-hover); color: var(--brand-white); text-decoration: none; }
.btn-secondary { background: var(--brand-white); color: var(--brand-gray-900); border: 1px solid var(--brand-gray-200); }
.btn-secondary:hover { background: var(--brand-gray-100); text-decoration: none; }
.btn-success { background: #2d6a2e; color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.page-actions { margin-bottom: 1rem; }

/* Status-Badges */
.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
  box-sizing: border-box;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.85;
}
.status-badge--lg {
  font-size: 0.78rem;
  padding: 0.45rem 1rem;
  min-width: 0;
  height: auto;
  letter-spacing: 0.03em;
}
.status-badge--lg::before { width: 7px; height: 7px; }
.status-badge--card,
.status-badge--sm {
  flex-shrink: 0;
  align-self: flex-start;
  height: 1.375rem;
  min-width: 6.5rem;
  padding: 0 0.5rem;
  font-size: 0.625rem;
  letter-spacing: 0.025em;
  gap: 0.3rem;
}
.status-badge--card::before,
.status-badge--sm::before { width: 5px; height: 5px; }
.card-top .status-badge,
.cal-day-card-top .status-badge,
.cal-week-item .status-badge {
  flex-shrink: 0;
  align-self: flex-start;
  height: 1.375rem;
  min-width: 6.5rem;
  padding: 0 0.5rem;
  font-size: 0.625rem;
  letter-spacing: 0.025em;
  gap: 0.3rem;
}
.card-top .status-badge::before,
.cal-day-card-top .status-badge::before,
.cal-week-item .status-badge::before { width: 5px; height: 5px; }
.status-badge--pulse {
  animation: status-pulse 2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.badge-blue, .status-badge.badge-blue {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border-color: #93c5fd;
}
.badge-indigo, .status-badge.badge-indigo {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  border-color: #c7d2fe;
}
.badge-yellow, .status-badge.badge-yellow {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  color: #a16207;
  border-color: #fde047;
}
.badge-green, .status-badge.badge-green {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #15803d;
  border-color: #86efac;
}
.badge-orange, .status-badge.badge-orange {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  color: #c2410c;
  border-color: #fdba74;
}
.badge-gray, .status-badge.badge-gray {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  border-color: #cbd5e1;
}
.badge-purple, .status-badge.badge-purple {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  color: #7e22ce;
  border-color: #d8b4fe;
}
.badge-red, .status-badge.badge-red {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  border-color: #fca5a5;
}
.badge-slate, .status-badge.badge-slate {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: #334155;
  border-color: #cbd5e1;
}

/* Auftragskarten */
.card-auftrag { position: relative; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; }
.card-auftrag:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.08); }
.card-link-block { display: block; color: inherit; text-decoration: none; }
.card-link-block:hover { text-decoration: none; color: inherit; }
.card-title-block { flex: 1; min-width: 0; padding-right: 0.5rem; }
.card-adresse { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-container-tag {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.card-abhol-hint {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.75rem;
  color: #c2410c;
  font-weight: 500;
}
.card-abhol-hint--overdue { color: #b91c1c; }
.card-stand-hint {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.75rem;
  color: #475569;
  font-weight: 500;
}
.card-stand-hint--overdue { color: #b91c1c; }
.abholung-verlaengern-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid #fecaca;
  background: #fff7f7;
}
.alert-error .abholung-verlaengern-bar {
  margin-top: 0.75rem;
  padding: 0.65rem 0;
  border-top: 1px solid rgb(255 255 255 / 0.35);
  background: transparent;
}
.abholung-verlaengern-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7f1d1d;
  margin-right: 0.15rem;
}
.alert-error .abholung-verlaengern-label { color: inherit; }
.card-tausch-hint {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.75rem;
  color: #7e22ce;
  font-weight: 500;
}

/* Filter mit Status-Farben */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.filter-bar a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #64748b;
  text-decoration: none;
  transition: all 0.15s ease;
}
.filter-bar a:hover { border-color: #cbd5e1; background: #f8fafc; transform: translateY(-1px); }
.filter-bar a.active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  background: var(--brand-orange);
}
.filter-bar a.filter-all.active { background: var(--brand-black); }
.filter-bar a.badge-blue.active { background: #3b6ea5; }
.filter-bar a.badge-indigo.active { background: #4f46e5; }
.filter-bar a.badge-yellow.active { background: #ca8a04; }
.filter-bar a.badge-green.active { background: #16a34a; }
.filter-bar a.badge-orange.active { background: #ea580c; }
.filter-bar a.badge-gray.active { background: #64748b; }
.filter-bar a.badge-purple.active { background: #9333ea; }
.filter-bar a.badge-red.active { background: #dc2626; }
.filter-bar a.badge-slate.active { background: #475569; }

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}
.search-bar input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.search-bar input[type="search"]:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgb(234 88 12 / 0.15);
}
.search-hint { margin: -0.5rem 0 1rem; font-size: 0.85rem; }

.stammkunde-suche-wrap,
.adress-suche-wrap { margin-bottom: 1rem; position: relative; }
.stammkunde-suche-wrap > label,
.adress-suche-wrap > label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.875rem; }
.stammkunde-suche,
.adress-suche { position: relative; }
.stammkunde-suche input[type="search"],
.stammkunde-suche input[autocomplete="off"],
.adress-suche input[type="search"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.stammkunde-suche-wrap > input:not([type="search"]):not([type="hidden"]) {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.stammkunde-results,
.adress-suche-results {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
    max-height: 280px;
    overflow-y: auto;
}
.stammkunde-item,
.adress-suche-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.85rem;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}
.stammkunde-item:hover,
.adress-suche-item:hover { background: #fff8f3; }
.stammkunde-item strong,
.adress-suche-item strong { display: block; font-size: 0.875rem; }
.stammkunde-item span { display: block; font-size: 0.75rem; color: #64748b; margin-top: 0.15rem; }
.stammkunde-empty,
.adress-suche-empty { padding: 0.75rem; color: #64748b; font-size: 0.85rem; }
.stammkunde-selected { margin: 0.35rem 0 0; font-size: 0.85rem; }
.stammkunde-options { margin: 0.75rem 0 1rem; }
.form-subheading { margin: 1.25rem 0 0.75rem; font-size: 0.95rem; font-weight: 600; }
.field-hint { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: #64748b; }
.field-hint-error { color: #dc2626; font-weight: 600; }
.rechnung-gleich-label { display: block; margin-bottom: 0.75rem; }
.rechnung-felder { margin-bottom: 0.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.link-btn { background: none; border: none; color: var(--brand-orange); cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }
.table-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.abholung-planen-form { margin-bottom: 0.75rem; }
.abholung-planen-form > label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.875rem; }
.abholung-planen-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.abholung-planen-row input[type="date"] {
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

/* Alerts */
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-info a { color: #1d4ed8; font-weight: 600; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--brand-orange);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.sidebar nav a.active .nav-badge { background: #fff; color: var(--brand-orange); }

.rechnung-intro { margin-bottom: 1rem; }
.rechnung-card { display: flex; flex-direction: column; }
.rechnung-dl { margin: 0.75rem 0 1rem; font-size: 0.875rem; }
.rechnung-dl dt { color: #64748b; font-weight: 500; margin-top: 0.5rem; }
.rechnung-dl dt:first-child { margin-top: 0; }
.rechnung-dl dd { margin: 0.15rem 0 0; }
.rechnung-kosten-summe { color: #b45309; font-size: 1.05rem; }
.card-abschliessen-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid #bbf7d0;
  background: #f0fdf4;
}
.card-abschliessen-info { font-size: 0.75rem; line-height: 1.35; }
.rechnung-form { margin-top: auto; padding-top: 0.75rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 1rem; }
.stat-value { font-size: 1.75rem; font-weight: bold; }
.stat-label { font-size: 0.875rem; color: #64748b; }
.stat-danger .stat-value { color: #dc2626; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; color: #64748b; font-weight: 500; }
.empty { text-align: center; color: #94a3b8; padding: 2rem; }

/* Grid */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.muted { color: #64748b; font-size: 0.875rem; }

/* Detail */
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.detail-header-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
dl dt { font-size: 0.75rem; color: #64748b; text-transform: uppercase; margin-top: 0.5rem; }
dl dd { margin-bottom: 0.25rem; }
.aktion-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.aktion-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem; margin-bottom: 0.75rem; }
.aktion-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.35rem; }
.aktion-delete-form { flex-shrink: 0; margin: 0; }
.abholungen-filter { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.abholungen-filter .form-group { margin-bottom: 0; min-width: 140px; }
.abholungen-filter .form-group-grow { flex: 1; min-width: 200px; }
.abholungen-filter .form-group label { font-size: 0.75rem; margin-bottom: 0.25rem; }
.aktion-fahrzeug { margin-top: 0.35rem; font-size: 0.875rem; color: #475569; }
.aktion-material { margin-top: 0.35rem; font-size: 0.875rem; color: #334155; }

.tagebuch-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.tagebuch-card { margin-top: 0.5rem; }
.tagebuch-title { color: #c41e3a; font-size: 1.15rem; margin: 0 0 0.35rem; font-weight: 700; }
.tagebuch-subtitle { margin: 0 0 1rem; }
.tagebuch-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tagebuch-table th,
.tagebuch-table td { border: 1px solid #cbd5e1; padding: 0.5rem 0.65rem; text-align: left; vertical-align: top; }
.tagebuch-table thead th { background: #f8fafc; font-weight: 600; }
.tagebuch-table tfoot td { background: #f8fafc; }
.tagebuch-table .col-nr { width: 4.5rem; text-align: center; }
.tagebuch-table .col-num { text-align: right; white-space: nowrap; }

.print-document { margin-top: 0.5rem; }
.print-header {
    display: none;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}
.print-logo { height: 52px; width: auto; }
.print-title { margin: 0; font-size: 1.35rem; color: #c41e3a; font-weight: 700; }
.print-subtitle { margin: 0.25rem 0 0; color: #64748b; font-size: 0.95rem; }
.tagebuch-gruppe { margin-top: 1.5rem; }
.tagebuch-gruppe-title {
    color: #c41e3a;
    font-size: 1rem;
    margin: 0 0 0.5rem;
    font-weight: 700;
}
.print-gruppe { display: none; }

@media print {
    @page { size: A4 landscape; margin: 10mm 12mm; }
    body { background: #fff !important; font-size: 10pt; }
    .sidebar, .topbar, .no-print, .sidebar-footer, .abholungen-filter, .tagebuch-nav { display: none !important; }
    .layout, .main { display: block !important; width: 100% !important; }
    .main { padding: 0 !important; max-width: none !important; }
    .card { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 !important; }
    .print-header { display: flex !important; }
    .print-document { margin: 0; }
    .tagebuch-title, .tagebuch-subtitle { display: none !important; }
    .screen-alle-materialien { display: none !important; }
    .print-gruppe { display: block !important; page-break-inside: avoid; margin-bottom: 1rem; }
    .tagebuch-gruppe-title { color: #000 !important; font-size: 11pt; }
    .tagebuch-table { font-size: 9pt; }
    .tagebuch-table th,
    .tagebuch-table td { padding: 0.35rem 0.45rem; }
    .tagebuch-table thead th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.admin-delete-list { display: flex; flex-direction: column; gap: 0.35rem; }
.admin-delete-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.35rem 0; border-top: 1px solid #f1f5f9; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.foto-item { display: flex; flex-direction: column; gap: 0.35rem; }
.foto-item small { font-size: 0.7rem; color: #64748b; line-height: 1.3; }
.foto-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
}
.foto-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.foto-thumb:hover img,
.foto-thumb:focus-visible img {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
}
.foto-thumb:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 2px; }

.foto-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.foto-lightbox[hidden] { display: none !important; }
.foto-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.85);
  cursor: zoom-out;
}
.foto-lightbox-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(96vw, 1200px);
  max-height: 96vh;
}
.foto-lightbox-img {
  max-width: 100%;
  max-height: calc(96vh - 4rem);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.35);
  background: #fff;
}
.foto-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}
.foto-lightbox-close:hover { background: #f1f5f9; }
.foto-lightbox-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* Calendar */
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e2e8f0; border-radius: 8px; overflow: hidden; }
.cal-head { background: #f8fafc; padding: 0.5rem; text-align: center; font-size: 0.75rem; font-weight: 600; color: #64748b; }
.cal-day { background: #fff; min-height: 90px; padding: 0.35rem; font-size: 0.75rem; }
.cal-day.muted-day { opacity: 0.45; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--brand-orange); }
.cal-day.feiertag { background: #fef2f2; }
.cal-day-num { font-weight: 600; margin-bottom: 0.25rem; }
.cal-feiertag {
    font-size: 0.62rem;
    line-height: 1.25;
    color: #b91c1c;
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding: 0.1rem 0.25rem;
    background: rgb(254 226 226 / 0.85);
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-feiertag-badge {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: #b91c1c;
    line-height: 1.25;
}
.cal-feiertag-banner {
    margin-bottom: 1rem;
    padding: 0.65rem 0.85rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 0.875rem;
}
.cal-week-col.feiertag { background: #fef2f2; border-color: #fecaca; }
.cal-week-col.feiertag.today { background: #fff1f2; }
.cal-event { display: block; padding: 0.15rem 0.3rem; border-radius: 4px; margin-bottom: 2px; font-size: 0.65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: inherit; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.75rem; }
.cal-week-col { border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.5rem; min-height: 150px; }
.cal-week-col.today { border-color: var(--brand-orange); background: #fff8f3; }
.cal-week-head { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; }
.cal-card { display: block; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.5rem; margin-bottom: 0.5rem; font-size: 0.8rem; text-decoration: none; color: inherit; }
.cal-card strong { display: block; margin-bottom: 0.25rem; }
.cal-card .badge { margin-top: 0.35rem; }
.cal-typ { display: block; font-size: 0.75rem; margin-top: 0.2rem; line-height: 1.35; }
.cal-typ-lieferung { color: #166534; font-weight: 500; }
.cal-typ-abholung { color: #9a3412; font-weight: 500; }
.cal-typ-tausch { color: #7e22ce; font-weight: 500; }
.cal-typ-hinweis { color: #64748b; font-size: 0.7rem; font-style: italic; }
.cal-day-card { padding: 1rem; }
.cal-day-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.35rem; }
.cal-mitarbeiter { margin-top: 0.35rem; font-size: 0.8rem; }
.cal-mitarbeiter-inline { display: block; margin-top: 0.25rem; font-size: 0.72rem; color: #475569; font-weight: 500; }
.cal-mitarbeiter-offen { color: #94a3b8; font-weight: 400; font-style: italic; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; font-size: 0.8rem; color: #64748b; }
.cal-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; flex-shrink: 0; }
.cal-legend-dot.lieferung { background: #16a34a; }
.cal-legend-dot.abholung { background: #ea580c; }
.cal-legend-dot.tausch { background: #9333ea; }
.cal-legend-dot.feiertag { background: #dc2626; }
.cal-legend-box { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; font-size: 0.8rem; color: #475569; }
.cal-legend-title { margin: 0 0 0.75rem; font-size: 0.85rem; font-weight: 600; color: #1e293b; }
.cal-legend-grid { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
@media (min-width: 640px) { .cal-legend-grid { grid-template-columns: 1fr 1fr; } }
.cal-legend-item { display: flex; align-items: flex-start; gap: 0.35rem; line-height: 1.4; }
.cal-legend-kuerzel { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.75rem 1rem; }
.cal-legend-kuerzel-title { margin: 0 0 0.5rem; font-weight: 600; font-size: 0.8rem; color: #334155; }
.cal-kuerzel-list { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0.5rem; }
.cal-kuerzel-list code { background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.1rem 0.35rem; font-size: 0.75rem; font-weight: 600; color: var(--brand-orange); margin-right: 0.35rem; }
.cal-legend-hint { margin: 0; font-size: 0.75rem; color: #64748b; }
.cal-day-list { display: grid; gap: 0.75rem; }

/* Route */
.route-stop { display: flex; gap: 1rem; align-items: flex-start; }
.route-num { width: 32px; height: 32px; background: var(--brand-orange); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; }
.route-info { flex: 1; }

/* Notifications */
.notif-wrap { position: relative; z-index: 30; }
.notif-btn { background: none; border: none; font-size: 1.25rem; cursor: pointer; position: relative; padding: 0.5rem; line-height: 1; }
.notif-badge { position: absolute; top: 0; right: 0; background: #dc2626; color: #fff; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.notif-panel { display: none; position: absolute; right: 0; top: calc(100% + 0.35rem); width: 320px; min-height: 48px; max-height: 400px; overflow-y: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); z-index: 1000; }
.notif-panel.open { display: block; }
.notif-item { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: 0.875rem; }
.notif-item.unread { background: #fff8f3; }
.notif-item strong { display: block; }
.notif-mark { display: block; width: 100%; text-align: center; padding: 0.5rem; font-size: 0.8rem; cursor: pointer; color: var(--brand-orange); background: none; border: none; border-bottom: 1px solid #f1f5f9; }
.notif-mark:hover { background: #fff8f3; }

/* Dialog */
body.mucha-dialog-open { overflow: hidden; }
.mucha-dialog {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.mucha-dialog[hidden] { display: none !important; }
.mucha-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.45);
}
.mucha-dialog__box {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.2);
  padding: 1.25rem 1.35rem 1.1rem;
}
.mucha-dialog__title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-black);
}
.mucha-dialog__message {
  margin: 0 0 1.1rem;
  color: #334155;
  line-height: 1.45;
  white-space: pre-wrap;
}
.mucha-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.mucha-dialog__cancel[hidden] { display: none !important; }

.btn-danger { background: #dc2626; color: #fff; }
.storno-card { border-color: #fecaca; background: #fff7f7; }
.storno-card h3 { margin-top: 0; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.mb-3 { margin-bottom: 1rem; }
.row-inactive { opacity: 0.65; background: #fafafa; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.perm-list { padding-left: 1.25rem; color: #475569; font-size: 0.9rem; }
.perm-list li { margin-bottom: 0.35rem; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: #e2e8f0; }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -1.5rem; top: 4px; width: 14px; height: 14px; background: var(--brand-orange); border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-orange); }
.timeline-content strong { display: block; color: #0f172a; }
.timeline-content .muted { margin-top: 0.25rem; display: block; }

/* Mobile */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: flex-start; }
    .nav-section { display: contents; }
    .nav-section-label { flex: 0 0 100%; width: 100%; padding: 0.5rem 0.25rem 0; }
    .nav-section + .nav-section .nav-section-label { border-top: 1px solid #333; margin-top: 0.35rem; padding-top: 0.65rem; }
    .sidebar nav a { flex: 1; text-align: center; font-size: 0.8rem; min-width: calc(50% - 0.25rem); }
    .app-logo--sidebar { max-width: 160px; }
    .app-logo--topbar { display: block; }
    .sidebar-brand .app-logo--sidebar { display: none; }
    .sidebar-tagline { display: none; }
    .detail-grid, .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .cal-week { grid-template-columns: 1fr; }
    .cal-month { font-size: 0.7rem; }
}
