/* LOKALE DSGVO-KONFORME EINBINDUNG DER SCHRIFTART INTER (SELF-HOSTED) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-latin-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-latin-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-latin-700.woff2') format('woff2');
}

/* CSS VARIABLE DEKLARATION (LIGHT & DARK MODE) */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #16a34a;
}

/* DARK MODE OVERRIDES */
[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary: #38bdf8;
  --primary-hover: #0284c7;
}

/* DARK MODE INPUTCARD & FORM OVERRIDES */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #0f172a;
  color: #f8fafc;
  border-color: #334155;
}

[data-theme="dark"] .task-item {
  background-color: #0f172a;
}

[data-theme="dark"] .dropdown-content {
  background-color: #1e293b;
}

[data-theme="dark"] .dropdown-content a {
  color: #f8fafc;
  border-bottom-color: #334155;
}

/* THEME TOGGLE SLIDER STYLING */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}

.theme-switch {
  display: inline-block;
  height: 22px;
  position: relative;
  width: 44px;
}

.theme-switch input {
  display: none;
}

.slider {
  background-color: #cbd5e1;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .3s;
}

.slider:before {
  background-color: #ffffff;
  bottom: 3px;
  content: "";
  height: 16px;
  left: 3px;
  position: absolute;
  transition: .3s;
  width: 16px;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

/* STICKY FOOTER LAYOUT */
html, body {
  height: 100%;
}

body { 
  background-color: var(--bg); 
  color: var(--text); 
  line-height: 1.5; 
  display: flex; 
  flex-direction: column; 
}

/* Der Inhalts-Container dehnt sich aus */
.page-content { 
  flex: 1 0 auto;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 40px 24px; 
}

/* HEADER STYLING */
header {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto 24px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 20px 24px;
  border-bottom: 2px solid var(--border);
}

header h1 { 
  font-size: 1.8rem; 
  color: var(--primary); 
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.header-user-info {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 1px;
  opacity: 0.85;
}

.user-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
  flex-shrink: 0;
}

.user-label {
  opacity: 0.8;
  font-weight: 400;
}

.user-name {
  font-weight: 500;
  color: var(--text-muted);
}

.logo-link {
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.logo-link:hover {
  opacity: 0.85;
}

.header-right { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}

.stats-container { display: flex; gap: 8px; }
.stat-badge { font-size: 0.8rem; font-weight: 700; padding: 6px 12px; border-radius: 20px; }
.stat-open { background-color: #dbeafe; color: #1e40af; }
.stat-done { background-color: #dcfce7; color: #166534; }

/* HEADER BUG REPORT BUTTON */
.header-bug-btn {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 7px 13px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}

[data-theme="dark"] .header-bug-btn {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.header-bug-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
}

/* BUG REPORT MODAL STYLING */
.bug-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.bug-modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.bug-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.bug-modal-header h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bug-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.bug-modal-close:hover { color: var(--danger); }

.bug-form-group {
  margin-bottom: 14px;
}

.bug-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.bug-form-group input,
.bug-form-group select,
.bug-form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.bug-form-group input:focus,
.bug-form-group select:focus,
.bug-form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bug-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.bug-btn-cancel {
  background: var(--border);
  color: var(--text);
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.bug-btn-cancel:hover { opacity: 0.85; }

.bug-btn-submit {
  background: #ef4444;
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}
.bug-btn-submit:hover { background: #dc2626; }

/* BUG STATUS BADGES & ADMIN FILTERS */
.bug-filter-btn {
  background: var(--border);
  color: var(--text);
  border: none;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.bug-filter-btn.active,
.bug-filter-btn:hover {
  background: var(--primary);
  color: white;
}

.bug-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.bug-status-offen { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.bug-status-in_bearbeitung { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.bug-status-erledigt { background: rgba(22, 163, 74, 0.15); color: #16a34a; border: 1px solid rgba(22, 163, 74, 0.3); }

.bug-severity-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 4px;
}
.bug-severity-high { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .bug-severity-high { background: #7f1d1d; color: #fecaca; }
.bug-severity-normal { background: #e0f2fe; color: #075985; }
[data-theme="dark"] .bug-severity-normal { background: #0c4a6e; color: #bae6fd; }
.bug-severity-low { background: #f1f5f9; color: #475569; }
[data-theme="dark"] .bug-severity-low { background: #334155; color: #cbd5e1; }

.nav-btn {
  background-color: var(--border);
  color: var(--text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.nav-btn:hover { 
  background-color: #cbd5e1; 
}

/* DATUM NAVIGATIONSLEISTE */
.date-bar {
  width: 100%;
  margin-bottom: 24px;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-wrap: wrap;
  gap: 12px;
}

.date-bar-left { 
  display: flex; 
  align-items: center; 
  gap: 16px; 
  flex-wrap: wrap; 
}
.date-nav-controls { display: flex; align-items: center; gap: 10px; }
.date-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
  transition: background 0.2s;
}
.date-btn:hover { background: #e2e8f0; }

.date-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-new-einsatz {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.btn-new-einsatz:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-new-einsatz:active {
  transform: translateY(0);
}

.toggle-all-btn {
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.toggle-all-btn.active { 
  background: #dbeafe; 
  color: #1e40af; 
  border-color: var(--primary); 
  font-weight: 600;
}

/* ==========================================================================
   ZENTRALE TECHNIKER-FILTERLEISTE
   ========================================================================== */
.dashboard-controls-bar {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  overflow-x: auto;
}

[data-theme="dark"] .dashboard-controls-bar {
  background: var(--card-bg);
  border-color: var(--border);
}

.dashboard-controls-bar .techniker-tabs {
  padding-bottom: 0;
  margin-bottom: 0;
  width: 100%;
}

/* SPALTEN-HEADER & COUNT PILLS */
.col-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.col-header-row h2 {
  margin-bottom: 0 !important;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-count-pill {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  margin-left: 6px;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .col-count-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.col-count-pill-done {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.25);
}

[data-theme="dark"] .col-count-pill-done {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.col-count-pill-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

[data-theme="dark"] .col-count-pill-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

/* HARMONISCHES 2-SPALTEN DASHBOARD GRID */
main.dashboard-grid,
main:not(.timeline-layout):not(.kunden-layout):not(.chat-main-container):not(.benutzer-layout):not(.admin-grid) {
  width: 100%;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  main.dashboard-grid,
  main:not(.timeline-layout):not(.kunden-layout):not(.chat-main-container):not(.benutzer-layout):not(.admin-grid) {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.card h2 { 
  font-size: 1.15rem; 
  margin-bottom: 16px; 
  display: flex;
  align-items: center;
  gap: 8px;
}

/* DYNAMISCHER SCROLLCONTAINER HÖHE */
.scrollable-container { 
  max-height: 650px; 
  overflow-y: auto; 
  padding-right: 4px; 
  flex: 1;
}
.scrollable-container::-webkit-scrollbar { width: 6px; }
.scrollable-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* FORMULARE */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--text-muted); }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { 
  width: 100%; 
  padding: 9px 12px; 
  border: 1px solid var(--border); 
  border-radius: 6px; 
  font-size: 0.95rem; 
  background-color: var(--card-bg);
  color: var(--text);
}
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-top: -6px;
  margin-bottom: 12px;
}
.checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.btn-group { display: flex; gap: 8px; margin-top: 8px; }
button[type="submit"] { 
  width: 100%; 
  background-color: var(--primary); 
  color: white; 
  border: none; 
  padding: 10px; 
  border-radius: 6px; 
  font-weight: 600; 
  cursor: pointer; 
  transition: background 0.2s;
}
button[type="submit"]:hover { background-color: var(--primary-hover); }
.btn-cancel { 
  background-color: var(--text-muted); 
  display: none; 
  color: white; 
  border: none; 
  padding: 10px; 
  border-radius: 6px; 
  cursor: pointer; 
}

/* AUFKLAPPBARE ACCORDIONS */
.day-group { 
  margin-bottom: 12px; 
  border: 1px solid var(--border); 
  border-radius: 8px; 
  overflow: hidden; 
}

.day-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.day-header.done { color: var(--success); }
.day-header:hover { opacity: 0.9; }

.task-list { list-style: none; padding: 10px; background: var(--card-bg); }
.task-item { 
  padding: 14px 16px; 
  border: 1px solid var(--border); 
  border-radius: 10px; 
  margin-bottom: 12px; 
  background: var(--bg); 
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
  position: relative;
}
.task-item:last-child { margin-bottom: 0; }
.task-item:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.task-item.open-item { border-left: 4px solid var(--primary); }
.task-item.done-item { border-left: 4px solid var(--success); }

.task-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-start; 
  gap: 10px;
  margin-bottom: 8px; 
}

.task-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-order-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.2;
}

.task-customer-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.task-baustelle-badge {
  background: rgba(15, 118, 110, 0.15);
  color: #0f766e;
  border: 1px solid rgba(15, 118, 110, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .task-baustelle-badge {
  background: rgba(20, 184, 166, 0.2);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.35);
}

.time-badge { 
  font-size: 0.75rem; 
  font-weight: 600; 
  background: var(--card-bg); 
  color: var(--text); 
  border: 1px solid var(--border);
  padding: 4px 9px; 
  border-radius: 6px; 
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* META INFORMATION */
.task-info-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.task-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.task-info-row strong, .task-info-row span.info-val {
  color: var(--text);
}

.task-info-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.task-info-link:hover {
  text-decoration: underline;
}

.task-description {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  margin: 8px 0;
}

/* CALLOUT BOXES: AUFGABE, NOTIZ, MATERIAL */
.task-description-box,
.task-note-box,
.task-material-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
}

.task-description-box > span:first-child,
.task-note-box > span:first-child,
.task-material-box > span:first-child {
  font-size: 0.95rem;
  line-height: 1.2;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-description-box > div,
.task-note-box > div,
.task-material-box > div {
  flex: 1;
}

.task-description-box strong,
.task-note-box strong,
.task-material-box strong {
  color: var(--text);
  font-weight: 700;
}

.task-photos-wrapper {
  margin-top: 8px;
  background: rgba(56, 189, 248, 0.04);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.task-photos-header {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-photos-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.task-photos-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: normal;
}

.task-photos-grid {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
}

.photo-thumb-item {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background-color: var(--border);
}

.photo-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.photo-thumb-item:hover img {
  transform: scale(1.08);
}

.photo-thumb-more {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px dashed var(--primary);
}

.photo-thumb-more-sub {
  font-size: 0.6rem;
  font-weight: normal;
}

/* ==========================================================================
   2-TIER ACTION BAR SYSTEM
   ========================================================================== */
.card-actions-wrapper {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-actions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.card-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.card-tools-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.btn-card-tool {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-card-tool:hover {
  background: var(--border);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-card-tool.btn-tool-accent {
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.35);
}

[data-theme="dark"] .btn-card-tool.btn-tool-accent {
  background: rgba(20, 184, 166, 0.18);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.35);
}

.btn-card-tool.btn-tool-accent:hover {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
}

.btn-card-tool-subtle {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-card-tool-subtle:hover {
  background: var(--border);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-card-tool-danger {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 9px;
}

.btn-card-tool-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

/* PRIMARY CTA ROW */
.card-primary-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-primary-cta {
  flex: 1;
  padding: 8px 14px;
  border-radius: 7px;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.btn-primary-cta:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-primary-cta:active {
  transform: translateY(0);
}

.btn-archive-cta {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-edit-cta {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.btn-restore-cta {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
}

.btn-status-pill {
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-status-pill:hover {
  transform: translateY(-1px);
}

.btn-status-pill.btn-followup-need {
  border-color: rgba(126, 34, 206, 0.35);
  color: #7e22ce;
  background: rgba(126, 34, 206, 0.06);
}

[data-theme="dark"] .btn-status-pill.btn-followup-need {
  border-color: rgba(192, 132, 252, 0.35);
  color: #c084fc;
  background: rgba(192, 132, 252, 0.1);
}

.btn-status-pill.btn-followup-need:hover {
  background: #7e22ce;
  color: #ffffff;
}

.btn-status-pill.btn-customer-missing {
  border-color: rgba(234, 88, 12, 0.35);
  color: #ea580c;
  background: rgba(234, 88, 12, 0.06);
}

[data-theme="dark"] .btn-status-pill.btn-customer-missing {
  border-color: rgba(251, 146, 60, 0.35);
  color: #fb923c;
  background: rgba(251, 146, 60, 0.1);
}

.btn-status-pill.btn-customer-missing:hover {
  background: #ea580c;
  color: #ffffff;
}

/* FOOTER FIXIERUNG */
.custom-footer {
  flex-shrink: 0;
  position: relative;
  background-color: #0284c7;
  color: white;
  padding: 20px;
  margin-top: 40px;
  text-align: center;
}
.footer-wave { position: absolute; top: -30px; left: 0; width: 100%; overflow: hidden; line-height: 0; }
.footer-wave svg { position: relative; display: block; width: calc(100% + 1.3px); height: 32px; }
.footer-wave .shape-fill { fill: #0284c7; }
.footer-text { font-size: 0.9rem; font-weight: 500; color: #e0f2fe; }

.footer-admin-icon {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.3s ease;
  vertical-align: middle;
  cursor: pointer;
}
.footer-admin-icon:hover {
  opacity: 1;
  transform: rotate(60deg) scale(1.15);
}

.version-tag {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Dropdown Container */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-btn {
  background-color: var(--primary);
  color: white;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.dropdown-btn:hover {
  background-color: var(--primary-hover);
}

.dropdown-arrow {
  font-size: 0.7rem;
}

/* Dropdown Inhalt */
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background-color: var(--card-bg);
  min-width: 230px;
  box-shadow: 0 10px 28px -4px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 1000;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  color: var(--text);
  padding: 11px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
  border-bottom: 1px solid var(--border);
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background-color: var(--bg);
  color: var(--primary);
  padding-left: 19px;
}

/* SPEZIELLE MENU-LINKS */
.menu-chat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-bug-link {
  color: #d97706 !important;
}

[data-theme="dark"] .menu-bug-link {
  color: #fbbf24 !important;
}

.menu-bug-link:hover {
  background-color: rgba(245, 158, 11, 0.08) !important;
  color: #b45309 !important;
}

[data-theme="dark"] .menu-bug-link:hover {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fde68a !important;
}

.menu-logout-link {
  color: var(--danger) !important;
}

.menu-logout-link:hover {
  background-color: rgba(239, 68, 68, 0.08) !important;
  color: #dc2626 !important;
}

[data-theme="dark"] .menu-logout-link:hover {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

/* CHAT INDIKATOR AM MENÜ-BUTTON */
.chat-menu-indicator {
  width: 9px;
  height: 9px;
  background-color: #ef4444;
  border-radius: 50%;
  display: inline-block;
  margin-left: 2px;
  margin-right: 2px;
  box-shadow: 0 0 0 2px var(--card-bg);
  animation: pulseChatDot 2s infinite;
}

@keyframes pulseChatDot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* ==========================================================================
   HEADER CHAT BADGE & BUTTON STYLES
   ========================================================================== */
.header-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  position: relative;
}

.header-chat-btn:hover {
  background-color: var(--primary);
  color: #ffffff;
}

.chat-badge, .menu-chat-badge, .chat-item-badge {
  background-color: var(--danger);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.role-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
}

.role-admin {
  background: #e3f2fd;
  color: #1976d2;
}

.role-buero {
  background: #f3e8ff;
  color: #7e22ce;
}

.role-techniker {
  background: #f1f8e9;
  color: #388e3c;
}

[data-theme="dark"] .role-admin {
  background: #1e3a8a;
  color: #60a5fa;
}

[data-theme="dark"] .role-buero {
  background: #3b0764;
  color: #c084fc;
}

[data-theme="dark"] .role-techniker {
  background: #064e3b;
  color: #34d399;
}

/* ==========================================================================
   CHAT SYSTEM LAYOUT & STYLES (BÜRO)
   ========================================================================== */
.chat-page-wrapper {
  height: calc(100vh - 120px);
  min-height: 500px;
}

.chat-main-container {
  display: flex !important;
  grid-template-columns: none !important;
  height: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* LEFT SIDEBAR */
.chat-sidebar {
  width: 320px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-header h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.chat-search-box input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background-color: var(--bg);
  color: var(--text);
}

.chat-channels-list {
  flex: 1;
  overflow-y: auto;
}

.chat-loading-spinner {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chat-channel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-channel-item:hover {
  background-color: rgba(37, 99, 235, 0.04);
}

.chat-channel-item.active {
  background-color: rgba(37, 99, 235, 0.1);
  border-left: 4px solid var(--primary);
}

.chat-channel-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.chat-channel-info {
  flex: 1;
  min-width: 0;
}

.chat-channel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 4px;
}

.chat-channel-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

.chat-channel-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-channel-preview span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

/* RIGHT VIEWPORT */
.chat-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  min-width: 0;
}

.chat-viewport-header {
  padding: 14px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-mobile-back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-user-info h3 {
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}

.chat-user-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* MESSAGES AREA */
.chat-messages-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  max-width: 320px;
  color: var(--text-muted);
}

.chat-message-group {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.chat-message-group.me {
  align-self: flex-end;
}

.chat-message-group.other {
  align-self: flex-start;
}

.chat-message-sender {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-left: 8px;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  position: relative;
  word-break: break-word;
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-message-group.me .chat-bubble {
  background-color: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-message-group.other .chat-bubble {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
}

.chat-message-text {
  line-height: 1.4;
}

.chat-message-time {
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
  opacity: 0.8;
}

.chat-message-group.other .chat-message-time {
  color: var(--text-muted);
}

.chat-message-image img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  display: block;
}

/* INPUT AREA */
.chat-input-area {
  padding: 14px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
}

.chat-file-btn {
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

.chat-file-btn:hover {
  background-color: var(--bg);
}

.chat-input-area input[type="text"] {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  padding: 12px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  outline: none;
  background-color: var(--bg);
  color: var(--text);
}

.chat-input-area input[type="text"]:focus {
  border-color: var(--primary);
}

.chat-input-area button[type="submit"] {
  flex-shrink: 0 !important;
  width: auto !important;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.chat-input-area button[type="submit"]:hover {
  background-color: var(--primary-hover);
}

.chat-input-area button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-image-preview-bar {
  padding: 8px 16px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-image-preview-bar img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.chat-image-preview-bar span {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}

.chat-image-preview-bar button {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
}

/* RESPONSIVE MOBILE CHAT */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 100%;
  }

  .chat-sidebar.mobile-hidden {
    display: none;
  }

  .chat-viewport {
    display: none;
  }

  .chat-viewport.mobile-active {
    display: flex;
  }

  .chat-mobile-back-btn {
    display: inline-block;
  }

  .header-chat-text {
    display: none;
  }
}
/* TECHNIKER TABS */
.techniker-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.techniker-tabs::-webkit-scrollbar {
  height: 6px;
}

.techniker-tabs::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.tech-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.tech-tab:hover {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--text-muted);
}

.tech-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 2. TECHNIKER BUTTONS */
.btn-tech-plus {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.btn-tech-plus:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-tech-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-tech-remove:hover {
  transform: scale(1.2);
}

/* ==========================================================================
   AUFTRAGSZETTEL PRINT TEMPLATE (ELEKTRO GRUNDMANN JEVENSTEDT)
   ========================================================================== */
#printJobTicket {
  display: none;
}

.az-sheet {
  width: 100%;
  max-width: 185mm;
  margin: 0 auto;
  font-family: Arial, Helvetica, sans-serif;
  color: #000 !important;
  background: #fff !important;
  font-size: 12.5px;
  line-height: 1.3;
}

.az-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.az-logo-wrap {
  width: 58%;
  padding-top: 2px;
}

.az-logo-img {
  max-width: 260px;
  height: auto;
  display: block;
}

.az-meta-box {
  width: 36%;
  border: 1.5px solid #000;
  background-color: #e2e8f0 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.az-meta-title {
  font-weight: bold;
  font-size: 13.5px;
  padding: 3px 6px;
  border-bottom: 1.5px solid #000;
}

.az-meta-row {
  display: flex;
  border-bottom: 1px solid #000;
  font-size: 12px;
}

.az-meta-row:last-child {
  border-bottom: none;
}

.az-meta-label {
  width: 55px;
  padding: 3px 5px;
  border-right: 1px solid #000;
  font-weight: bold;
}

.az-meta-val {
  flex: 1;
  padding: 3px 6px;
  font-weight: bold;
  background-color: #f8fafc !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.az-client-block {
  margin-top: 6px;
  margin-bottom: 10px;
}

.az-client-line {
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid #000;
  min-height: 21px;
  margin-bottom: 2px;
  padding-bottom: 1px;
}

.az-client-label {
  font-weight: bold;
  font-size: 12.5px;
  margin-right: 8px;
  white-space: nowrap;
}

.az-client-val {
  font-size: 13px;
  flex: 1;
}

.az-section-block {
  margin-top: 6px;
  margin-bottom: 8px;
}

.az-section-title {
  text-align: center;
  font-weight: bold;
  font-size: 13.5px;
  margin-bottom: 3px;
  letter-spacing: 0.2px;
}

.az-ruled-container {
  display: flex;
  flex-direction: column;
}

.az-ruled-line {
  border-bottom: 1px solid #000;
  height: 20px;
  line-height: 20px;
  font-size: 12px;
  padding-left: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.az-bottom-block {
  margin-top: 6px;
}

.az-monteur-line {
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid #000;
  min-height: 20px;
  margin-bottom: 2px;
  padding-bottom: 1px;
}

.az-monteur-label {
  font-weight: bold;
  font-size: 12px;
  width: 95px;
  flex-shrink: 0;
}

.az-monteur-val {
  font-size: 12.5px;
  flex: 1;
}

/* Centered Zones with Checkboxes */
.az-zones-centered {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  font-size: 12px;
  font-weight: bold;
  margin: 6px 0 8px 0;
  padding: 2px 0;
}

.az-zone-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.az-checkbox {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid #000;
  background-color: #fff !important;
  box-sizing: border-box;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.az-material-title {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 2px;
}

.az-material-lines {
  display: flex;
  flex-direction: column;
}

/* Signature at the very bottom */
.az-signature-bottom-row {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 6px;
}

.az-signature-block {
  width: 42%;
  text-align: center;
}

.az-signature-line {
  border-top: 1px solid #000;
  padding-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #000;
}


/* --- GLOBAL LIGHTBOX & PHOTO THUMBNAILS --- */
.photo-thumb-item {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.photo-thumb-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary) !important;
}

.photo-thumb-more {
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.photo-thumb-more:hover {
  transform: scale(1.05);
  background: rgba(37, 99, 235, 0.2) !important;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #f8fafc;
  z-index: 2;
  padding: 8px 0;
}

.lightbox-counter {
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.lightbox-btn-close {
  background: #ef4444;
  border-color: #ef4444;
  font-size: 1.1rem;
  padding: 6px 14px;
}

.lightbox-btn-close:hover {
  background: #dc2626;
}

.lightbox-stage {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1300px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin: 10px 0;
}

.lightbox-img-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s ease;
  user-select: none;
}

.lightbox-img.zoomed {
  cursor: grab;
  max-width: none;
  max-height: none;
  transform: scale(1.8);
}

.lightbox-spinner {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
  display: none;
}

@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.lightbox-nav-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-footer {
  color: #94a3b8;
  font-size: 0.8rem;
  text-align: center;
  padding: 4px 0;
}

/* Print Media Query */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 10mm 12mm;
  }

  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Allgemeine Ausblendungen beim Drucken */
  #header-container, 
  #footer-container, 
  .custom-footer, 
  .date-bar, 
  .toolbar,
  .archive-header-card, 
  .modal-overlay,
  .toast-container,
  .custom-toast,
  .btn-delete-icon {
    display: none !important;
  }

  /* Standardmäßig Auftragszettel-Container ausblenden (wird nur bei printing-ticket aktiv) */
  #printJobTicket {
    display: none !important;
  }

  /* SPEZIALMODUS: Auftragszettel / Baustellennachweis Druck */
  body.printing-ticket * {
    visibility: hidden;
  }

  body.printing-ticket .page-content,
  body.printing-ticket .archive-content-card {
    display: none !important;
  }

  body.printing-ticket #printJobTicket, 
  body.printing-ticket #printJobTicket * {
    visibility: visible;
  }

  body.printing-ticket #printJobTicket {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #000 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* FOTO VORSCHAU & DOWNLOAD BUTTON HOVER STYLES */
.btn-download-all-photos {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s;
}
.btn-download-all-photos:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
}
.photo-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.photo-thumb-item:hover img {
  transform: scale(1.08) !important;
}

/* ==========================================================================
   V1.4.0 UPGRADES: KUNDEN-AUTOCOMPLETE, KLÄRUNG, 7-TAGE-REMINDER & RECHNUNG
   ========================================================================== */

/* 1. KUNDEN AUTOCOMPLETE DROPDOWN */
.kunden-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.08);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kunden-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kunden-item:hover, .kunden-item.selected {
  background: rgba(37, 99, 235, 0.09);
  border-color: var(--primary);
  transform: translateX(3px);
}

.kunden-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kunden-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kunden-item-badge {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.kunden-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.kunden-new-hint {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 2. PERSISTENTER HORIZONTALER KLÄRUNGS- & FOLGETERMIN-BEREICH */
.klaerung-card {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 24px;
}

.klaerung-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 640px) {
  .klaerung-grid-container {
    grid-template-columns: 1fr;
  }
}

.klaerung-card-item {
  min-width: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.klaerung-card-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 8px;
}

.klaerung-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.klaerung-card-item .card-primary-action-row {
  flex-direction: column;
  align-items: stretch;
}

.klaerung-card-item .btn-primary-cta {
  flex: auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.klaerung-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .klaerung-card-item {
  background: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .klaerung-card-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.klaerung-card-item.status-kunde-nicht-angetroffen {
  border-left: 4px solid #ea580c;
}

.klaerung-card-item.status-weiterer-termin {
  border-left: 4px solid #9333ea;
}

.klaerung-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.badge-kunde-nicht-angetroffen {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  border: 1px solid rgba(234, 88, 12, 0.25);
}

[data-theme="dark"] .badge-kunde-nicht-angetroffen {
  background: rgba(234, 88, 12, 0.2);
  color: #fdba74;
  border-color: rgba(234, 88, 12, 0.35);
}

.badge-weiterer-termin {
  background: rgba(147, 51, 234, 0.12);
  color: #7e22ce;
  border: 1px solid rgba(147, 51, 234, 0.25);
}

[data-theme="dark"] .badge-weiterer-termin {
  background: rgba(147, 51, 234, 0.2);
  color: #d8b4fe;
  border-color: rgba(147, 51, 234, 0.35);
}

/* 3. 7-TAGE ABRECHNUNGS-REMINDER BANNER (MODERNES SLEEK DESIGN) */
.archive-reminder-banner {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.95) 0%, rgba(255, 251, 235, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #d97706;
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.08);
  backdrop-filter: blur(8px);
  animation: slideDown 0.25s ease-out;
}

[data-theme="dark"] .archive-reminder-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-left: 4px solid #f59e0b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.archive-reminder-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.archive-reminder-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

[data-theme="dark"] .archive-reminder-icon-badge {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

.archive-reminder-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.archive-reminder-headline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.archive-reminder-headline strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #92400e;
}

[data-theme="dark"] .archive-reminder-headline strong {
  color: #fde68a;
}

.archive-reminder-count-pill {
  background: #d97706;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.archive-reminder-sub {
  font-size: 0.76rem;
  color: #b45309;
  opacity: 0.9;
  line-height: 1.2;
}

[data-theme="dark"] .archive-reminder-sub {
  color: #94a3b8;
  opacity: 0.85;
}

.archive-reminder-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-banner-ignore {
  background: transparent;
  border: 1px solid rgba(180, 83, 9, 0.35);
  color: #92400e;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .btn-banner-ignore {
  border-color: rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

.btn-banner-ignore:hover {
  background: rgba(180, 83, 9, 0.08);
  border-color: #b45309;
  color: #78350f;
}

[data-theme="dark"] .btn-banner-ignore:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.btn-banner-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
  transition: all 0.15s ease;
}

.btn-banner-primary:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-banner-close {
  background: transparent;
  border: none;
  color: #b45309;
  font-size: 1.1rem;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
  opacity: 0.7;
}

[data-theme="dark"] .btn-banner-close {
  color: #94a3b8;
}

.btn-banner-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .btn-banner-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* 4. RECHNUNGS-BADGE IM ARCHIV */
.rechnung-area {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.rechnung-badge-ok {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

[data-theme="dark"] .rechnung-badge-ok {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.btn-rechnung-upload {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: 1px dashed var(--primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-rechnung-upload:hover {
  background: var(--primary);
  color: #ffffff;
  border-style: solid;
}

/* 5. BAUSTELLEN BADGE */
.baustelle-badge {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .baustelle-badge {
  background: rgba(22, 101, 52, 0.25);
  color: #86efac;
  border-color: #166534;
}

/* 6. MODAL OVERLAY & ARCHIVE REVIEW STYLES */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  backdrop-filter: blur(6px);
  padding: 16px;
  animation: fadeInModal 0.2s ease-out;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  animation: scaleUpModal 0.2s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUpModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.archive-modal-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.archive-modal-item:hover {
  border-color: var(--primary);
}

.archive-modal-item-clickable {
  cursor: pointer;
  user-select: none;
}

.archive-modal-item-clickable:hover {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.archive-item-detail-badge {
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.archive-modal-item-clickable:hover .archive-item-detail-badge {
  background: var(--primary) !important;
  color: #ffffff !important;
  transform: scale(1.04);
}

.btn-archive-detail-open {
  transition: all 0.15s ease;
}

.btn-archive-detail-open:hover {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.archive-modal-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.archive-modal-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* AUFTRAGS-DETAIL MODAL STYLES */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.detail-info-card {
  background: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.detail-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.detail-info-val {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

/* 7. EINSATZ MODAL SPEZIFISCHE STYLES */
.einsatz-modal-card {
  max-width: 720px;
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.einsatz-modal-header {
  padding: 18px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.einsatz-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.einsatz-modal-body::-webkit-scrollbar {
  width: 6px;
}
.einsatz-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.einsatz-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-submit-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-submit-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-submit-primary:active {
  transform: translateY(0);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Büro-Arbeitsbereich: Navigation, Suche, kompakte Aufträge und Status. */
.workspace-bar { width: 100%; max-width: 1600px; margin: -12px auto 12px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; }
.primary-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.primary-nav a { padding: 9px 13px; border-radius: 7px; color: var(--text-muted); font-size: .88rem; font-weight: 600; text-decoration: none; }
.primary-nav a:hover { color: var(--primary); background: var(--card-bg); }
.primary-nav a[aria-current="page"] { color: var(--primary); background: var(--card-bg); box-shadow: inset 0 -2px var(--primary); }
.save-status { font-size: .76rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 7px; }
.save-status::before { content: ''; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--success); }
.save-status[data-state="saving"]::before, .save-status[data-state="offline"]::before { background: var(--warning); }
.save-status[data-state="error"] { color: var(--danger); }
.save-status[data-state="error"]::before { background: var(--danger); }
.header-with-search { gap: 24px; }
.header-search { position: relative; flex: 1 1 280px; min-width: 180px; max-width: 360px; }
.header-search-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.header-search-input:focus-within { border-color: var(--primary); }
.header-search-icon { color: var(--text-muted); font-size: 1.4rem; line-height: 1; }
#globalOrderSearch { min-width: 0; flex: 1; margin: 0; padding: 9px 0; border: 0; background: transparent; box-shadow: none; font-size: .85rem; }
#globalOrderSearch:focus { outline: none; box-shadow: none; }
#globalOrderSearch::-webkit-search-cancel-button { display: none; }
#clearGlobalSearch { background: transparent; border: 0; color: var(--text-muted); padding: 4px; font-size: 1.2rem; cursor: pointer; }
.search-accessible-hint { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#customerHistoryHint { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }
#globalSearchResults { position: absolute; top: calc(100% + 8px); left: 0; width: max(100%, 420px); max-height: min(420px, 60vh); overflow-y: auto; z-index: 100; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.order-search-result { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 12px; text-align: left; color: var(--text); background: var(--card-bg); border: 1px solid var(--border); border-radius: 7px; margin: 8px 0; text-decoration: none; cursor: pointer; overflow-wrap: anywhere; font-size: .88rem; }
.order-search-result span { color: var(--text-muted); font-size: .8rem; }
.order-search-result:hover, .order-search-result:focus-visible { border-color: var(--primary); }
.search-result-count { margin: 10px 0; color: var(--text-muted); font-size: .85rem; }
.planning-warning { background: #fff7ed; border: 1px solid #f59e0b; border-radius: 8px; padding: 12px; color: #9a3412; font-size: .85rem; margin-bottom: 16px; }
[data-theme="dark"] .planning-warning { background: #431407; color: #fed7aa; }
.task-disclosure summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 7px; border-radius: 5px; }
.task-disclosure summary::-webkit-details-marker { display: none; }
.task-disclosure summary:focus-visible, .primary-nav a:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.task-summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.task-summary-heading strong { font-size: .95rem; color: var(--text); }
.task-summary-meta { font-size: .8rem; color: var(--text-muted); }
.task-summary-description { color: var(--text); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-disclosure-label { font-size: .76rem; font-weight: 600; color: var(--primary); }
.task-disclosure-label::after { content: ' ▾'; }
.task-disclosure[open] .task-disclosure-label::after { content: ' ▴'; }
.task-expanded { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.task-expanded .task-header { display: none; }
.task-expanded .btn-primary-cta { box-shadow: none; }
.task-disclosure .card-actions-toolbar { gap: 8px; }
.task-disclosure .card-primary-action-row { flex-wrap: wrap; }
.customer-history-dialog, .planning-confirm-dialog { width: min(760px, calc(100% - 32px)); max-height: 85vh; margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); color: var(--text); }
.customer-history-dialog::backdrop, .planning-confirm-dialog::backdrop { background: rgba(15,23,42,.55); }
.planning-confirm-dialog h2 { font-size: 1.2rem; margin-bottom: 12px; }
.planning-conflict-list { white-space: pre-line; overflow-wrap: anywhere; margin: 16px 0; color: var(--text-muted); }
.planning-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.history-dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.history-dialog-header h2 { font-size: 1.2rem; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  header { flex-wrap: wrap; gap: 14px; padding: 16px; }
  header h1 { font-size: 1.35rem; flex-wrap: wrap; }
  .header-left { align-items: flex-start; min-width: 0; }
  .header-right { flex-wrap: wrap; }
  .header-user-info { flex-wrap: wrap; justify-content: flex-start; }
  .workspace-bar { padding: 0 16px; }
  .primary-nav a { padding: 9px; font-size: .81rem; }
  .date-bar-left { min-width: 0; max-width: 100%; }
  .date-nav-controls { flex-wrap: wrap; }
  .history-dialog-header { align-items: flex-start; flex-wrap: wrap; }
  .task-summary-heading { flex-wrap: wrap; gap: 4px; }
}
@media (max-width: 600px) {
  .einsatz-modal-body { padding: 16px; }
  #einsatzForm .form-row { flex-direction: column; gap: 0; }
  #einsatzForm .form-group { min-width: 0; }
  .einsatz-modal-footer { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .header-with-search { flex-wrap: wrap; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; min-width: 0; }
  #globalSearchResults { width: 100%; }
}
