/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #eff6ff;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 200px;
  --header-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--gray-800); background: var(--gray-50); }

/* ── Utility ── */
.hidden { display: none !important; }
.spacer { flex: 1; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; }

/* ── Login ── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); }
.login-card { background: white; border-radius: 12px; padding: 2.5rem 2rem; width: 360px; box-shadow: var(--shadow-lg); }
.login-logo { color: var(--blue); margin-bottom: 1rem; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.login-sub { color: var(--gray-500); margin-top: .25rem; margin-bottom: 1.5rem; font-size: .875rem; }

/* ── Form primitives ── */
.form-group { margin-bottom: .875rem; }
.form-group label { display: block; font-size: .75rem; font-weight: 600; color: var(--gray-600); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="color"], select, textarea {
  width: 100%; padding: .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .875rem; font-family: var(--font); color: var(--gray-800);
  background: white; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
input[type="color"] { padding: .25rem .375rem; height: 36px; cursor: pointer; }
.form-error { color: var(--red); font-size: .8rem; margin-top: .5rem; padding: .5rem .75rem; background: #fef2f2; border-radius: var(--radius); }
.form-success { color: var(--green); font-size: .8rem; margin-top: .5rem; padding: .5rem .75rem; background: #f0fdf4; border-radius: var(--radius); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.input-sm { padding: .375rem .625rem; font-size: .8rem; border: 1px solid var(--gray-300); border-radius: var(--radius); background: white; }
.input-full { width: 100%; padding: .5rem .75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: .875rem; }
.select-sm { padding: .35rem .625rem; font-size: .8rem; border: 1px solid var(--gray-300); border-radius: var(--radius); background: white; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .375rem; padding: .5rem 1rem; border-radius: var(--radius); font-size: .8rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all .15s; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-outline.active { background: #fef9c3; color: #854d0e; border-color: #fbbf24; font-weight: 600; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: .35rem .75rem; font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; padding: .625rem 1rem; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--gray-500); padding: .25rem; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon svg { width: 16px; height: 16px; }

/* ── Sidebar ── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); background: var(--gray-900); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 1rem; display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; border-bottom: 1px solid var(--gray-700); }
.sidebar-logo svg { color: var(--blue); }
.sidebar-nav { list-style: none; padding: .5rem 0; flex: 1; overflow-y: auto; }
.sidebar-nav li { padding: 0 .5rem; }
.nav-link { display: flex; align-items: center; gap: .625rem; padding: .6rem .75rem; border-radius: 6px; color: var(--gray-400); text-decoration: none; font-size: .8rem; font-weight: 500; transition: background .15s, color .15s; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: var(--gray-800); color: var(--gray-100); }
.nav-link.active { background: var(--blue); color: white; }
.sidebar-bottom { padding: .5rem; border-top: 1px solid var(--gray-700); }
.sidebar-user { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem; color: var(--gray-400); font-size: .75rem; }
.sidebar-user .btn-icon { color: var(--gray-400); }
.sidebar-user .btn-icon:hover { color: white; background: var(--gray-700); }

/* ── Main content ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.view { display: none; flex-direction: column; height: 100%; overflow: hidden; }
.view.active { display: flex; }
.inv-pane { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }

/* ── View header ── */
.view-header { display: flex; align-items: center; justify-content: space-between; padding: .875rem 1.25rem; background: white; border-bottom: 1px solid var(--gray-200); gap: 1rem; flex-shrink: 0; }
.view-header-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.view-header-right { display: flex; align-items: center; gap: .5rem; }
.view-header h2 { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); }

/* ── Calendar ── */
.calendar-wrap { flex: 1; overflow: auto; padding: 1rem 1.25rem 1rem 0; }
.calendar-grid { display: grid; min-width: 900px; }
.cal-header-row { display: contents; }
.cal-tech-label { font-size: .7rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; padding: .5rem .75rem; background: var(--gray-50); border-right: 1px solid var(--gray-200); border-bottom: 2px solid var(--gray-200); position: sticky; left: 0; z-index: 4; box-shadow: 3px 0 6px -2px rgba(0,0,0,.12); clip-path: inset(0 -10px 0 0); }
.cal-day-header { padding: .5rem .5rem; text-align: center; background: var(--gray-50); border-right: 1px solid var(--gray-200); border-bottom: 2px solid var(--gray-200); }
.cal-day-header .day-name { font-size: .7rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; }
.cal-day-header .day-num { font-size: 1rem; font-weight: 700; color: var(--gray-800); line-height: 1; }
.cal-day-header.today .day-num { color: var(--blue); }
.cal-day-header.weekend { background: var(--gray-100); }
.cal-tech-row { display: contents; }
.cal-tech-name { font-size: .75rem; font-weight: 600; color: var(--gray-700); padding: .5rem .75rem; background: white; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); position: sticky; left: 0; z-index: 3; display: flex; align-items: center; gap: .4rem; white-space: nowrap; box-shadow: 3px 0 6px -2px rgba(0,0,0,.12); clip-path: inset(0 -10px 0 0); }
.cal-tech-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-cell { padding: .25rem; background: white; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); min-height: 70px; vertical-align: top; cursor: pointer; transition: background .1s; position: relative; }
.cal-cell:hover { background: var(--blue-light); }
.cal-cell.weekend { background: var(--gray-50); }
.cal-cell.weekend:hover { background: #e0eaff; }
.tour-chip { background: var(--blue); color: white; border-radius: 4px; padding: .2rem .4rem; font-size: .7rem; font-weight: 600; margin-bottom: 2px; cursor: pointer; line-height: 1.3; transition: filter .15s; }
.tour-chip:hover { filter: brightness(1.15); }
.tour-chip .chip-stops { opacity: .85; font-weight: 400; }
/* Appointment chips in calendar */
.appt-chip { border-left: 3px solid var(--blue); background: white; border-radius: 3px; padding: .18rem .35rem; font-size: .68rem; margin-bottom: 2px; cursor: pointer; line-height: 1.3; box-shadow: 0 1px 2px rgba(0,0,0,.08); transition: box-shadow .1s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-chip:hover { box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.appt-chip .chip-time { font-weight: 700; color: var(--gray-600); margin-right: .25rem; font-size: .62rem; }
.appt-chip .chip-name { color: var(--gray-800); }
.appt-chip .chip-type-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--chip-type-color, #6b7280); margin-right: .25rem; flex-shrink: 0; vertical-align: middle; }
/* Absence chips */
.absence-chip { border-radius: 4px; padding: .2rem .4rem; font-size: .68rem; font-weight: 700; color: white; margin-bottom: 2px; cursor: pointer; line-height: 1.4; }
/* Heimfahrt */
.heimfahrt-tag { font-size: .58rem; color: var(--gray-500); padding: .1rem 0; margin-bottom: 1px; white-space: nowrap; }
.heimfahrt-tag.start { color: #0ea5e9; }
.heimfahrt-tag.end { color: #8b5cf6; }
/* Feiertag badge in header */
.feiertag-badge { font-size: .55rem; font-weight: 700; color: #b45309; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.cal-day-header.weekend .feiertag-badge { color: #dc2626; }
/* Appt assign info */
.appt-assign-info { padding: .5rem .6rem; background: var(--gray-50); border-radius: 6px; border: 1px solid var(--gray-200); }
.route-info { margin-top: .5rem; font-size: .75rem; color: var(--gray-600); padding: .4rem .5rem; background: var(--blue-light); border-radius: 4px; display: flex; align-items: center; gap: .35rem; }
.route-icon { font-size: .85rem; }
.tour-chip-empty { border: 1.5px dashed var(--gray-300); border-radius: 4px; padding: .15rem .3rem; font-size: .65rem; color: var(--gray-400); text-align: center; }

/* ── Week nav ── */
.week-nav { display: flex; align-items: center; gap: .25rem; }
.week-nav span { font-size: .85rem; font-weight: 600; color: var(--gray-700); padding: 0 .25rem; min-width: 180px; text-align: center; }

/* ── Map view ── */
.map-main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.map-container-wrap { flex: 1; position: relative; overflow: hidden; display: flex; min-height: 0; }
.leaflet-map { flex: 1; height: 100%; }
.map-selection-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; background: rgba(30,58,138,.85); color: white; padding: .4rem 1rem; border-radius: 99px; font-size: .8rem; font-weight: 600; pointer-events: none; }
.map-selection-hint kbd { background: white; color: #1e3a8a; border-radius: 4px; padding: 0 5px; font-family: monospace; font-size: .75rem; box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.leaflet-map.map-selectmode { cursor: grab; }
.leaflet-map.map-selectmode:active { cursor: grabbing; }
.map-filter-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.map-filter-bar > select,
.map-filter-bar .map-city-search { width: auto; flex: 0 0 auto; }
.map-filter-bar > select { min-width: 140px; }

/* Filter-Dropdown (Techniker + Status zusammen) */
.map-filter-dd { position: relative; display: inline-flex; }
.map-filter-dd .btn { display: inline-flex; align-items: center; gap: .4rem; }
.map-filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #3b82f6; color: white;
  border-radius: 99px; font-size: .7rem; font-weight: 700; line-height: 1;
}
.map-filter-badge.hidden { display: none; }
.map-filter-panel {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 240px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .75rem;
  z-index: 1100;
  display: flex; flex-direction: column; gap: .6rem;
}
.map-filter-panel.hidden { display: none; }
.map-filter-row { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; color: var(--gray-600); font-weight: 600; }
.map-filter-row select { width: 100%; }
.map-filter-panel .map-filter-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  justify-content: flex-start; width: 100%; text-align: left;
  margin-top: .25rem;
}
.map-filter-panel .map-filter-toggle .mft-check {
  width: 14px; height: 14px; border: 1.5px solid var(--gray-400);
  border-radius: 3px; display: inline-block; flex-shrink: 0;
  position: relative; background: white;
}
.map-filter-panel .map-filter-toggle.active { border-color: #3b82f6; color: #1e3a8a; background: #eff6ff; }
.map-filter-panel .map-filter-toggle.active .mft-check { background: #3b82f6; border-color: #3b82f6; }
.map-filter-panel .map-filter-toggle.active .mft-check::after {
  content: ''; position: absolute; left: 3px; top: 0px;
  width: 4px; height: 8px; border: solid white;
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}
#mapVertriebLayerBtn.active { border-color: #f97316; color: #9a3412; background: #fff7ed; }

.map-filter-countries { align-items: flex-start !important; }
.map-country-checkboxes { display: flex; flex-direction: column; gap: 3px; padding-top: 1px; }
.map-country-cb { display: flex; align-items: center; gap: 5px; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.map-country-cb input[type="checkbox"] { cursor: pointer; accent-color: #3b82f6; }

.map-filter-reset { display: block; width: 100%; margin-top: .25rem; padding: .25rem 0; font-size: .75rem; color: #6b7280; background: none; border: none; cursor: pointer; text-align: center; }
.map-filter-reset:hover { color: #ef4444; }

/* Städte-/Adress-Suche in der Karten-Toolbar */
.map-order-search-wrap { display: inline-flex; align-items: center; }
.map-order-search {
  padding: .35rem .7rem;
  font-size: .8rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  width: 200px;
  max-width: 100%;
  transition: width .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.map-order-search:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); width: 240px; }
.map-order-search:not(:placeholder-shown) { border-color: #f59e0b; background: #fffbeb; }

.map-city-search { position: relative; display: inline-flex; align-items: center; }
.map-city-search-input {
  padding: .35rem 1.85rem .35rem .625rem;
  font-size: .8rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  width: 230px;
  max-width: 100%;
  transition: width .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.map-city-search-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); width: 260px; }
.map-city-search-clear {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer; color: var(--gray-500);
  padding: .15rem .35rem; font-size: .85rem; line-height: 1; border-radius: 99px;
}
.map-city-search-clear:hover { background: var(--gray-100); color: var(--gray-700); }
.map-city-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  min-width: 280px;
  margin: 0; padding: .25rem 0; list-style: none;
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 1100; max-height: 320px; overflow-y: auto;
}
.map-city-search-results.hidden { display: none; }
.map-city-search-results li {
  padding: .45rem .7rem; cursor: pointer; font-size: .82rem;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px solid var(--gray-100);
}
.map-city-search-results li:last-child { border-bottom: 0; }
.map-city-search-results li:hover,
.map-city-search-results li.active { background: #eff6ff; }
.map-city-search-results li .mcs-title { font-weight: 600; color: var(--gray-900); }
.map-city-search-results li .mcs-sub { font-size: .72rem; color: var(--gray-500); }
.map-city-search-results li.mcs-info { cursor: default; color: var(--gray-500); font-style: italic; }
.map-city-search-results li.mcs-info:hover { background: transparent; }

/* Distanz-Block im Side-Panel bei fixiertem Such-Pin */
.sp-search-route {
  background: linear-gradient(180deg, #eff6ff 0%, #fafbff 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: .55rem .7rem;
}
.sp-search-route.hidden { display: none; }
.sp-sr-origin { font-size: .72rem; color: var(--gray-600); display: flex; align-items: center; gap: .3rem; }
.sp-sr-origin strong { color: var(--gray-800); font-weight: 600; }
.sp-sr-stats { display: flex; align-items: center; gap: .6rem; margin-top: .25rem; font-weight: 700; color: #1e3a8a; font-size: .95rem; }
.sp-sr-stats .sp-sr-sep { color: var(--gray-400); font-weight: 400; }
.sp-sr-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.sp-sr-actions .btn { font-size: .72rem; padding: .25rem .55rem; }
.sp-sr-loading { color: var(--gray-500); font-size: .8rem; font-style: italic; }
.sp-sr-err { color: #b91c1c; font-size: .78rem; }

/* Such-Pin Popup */
.city-search-pin-popup .leaflet-popup-content { margin: .55rem .7rem; }
.city-search-pin-popup .csp-actions { display: flex; gap: .35rem; margin-top: .4rem; }
.city-search-pin-popup .csp-actions button {
  font-size: .72rem; padding: .25rem .55rem;
  border: 1px solid var(--gray-300); background: white; border-radius: var(--radius); cursor: pointer;
}
.city-search-pin-popup .csp-actions button.primary { background: #3b82f6; color: white; border-color: #3b82f6; }
.city-search-pin-popup .csp-actions button:hover { filter: brightness(.96); }
.map-legend { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--gray-600); }
.map-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: .4rem; flex-shrink: 0; }
.map-type-counts { display: inline-flex; gap: .35rem; margin-left: .5rem; font-size: .75rem; }
.map-type-counts .mtc { display: inline-flex; align-items: center; gap: .3rem; padding: 3px 9px; border-radius: 99px; color: white; font-weight: 700; line-height: 1; white-space: nowrap; }
.map-type-counts .mtc-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.85); display: inline-block; }
/* Plan panel — sitzt unten unter der Karte, volle Breite */
.map-plan-panel { width: 100%; max-height: 42vh; min-height: 160px; background: white; border-top: 2px solid var(--gray-200); display: flex; flex-direction: column; flex-shrink: 0; }
.map-plan-panel.hidden { display: none; }
.plan-panel-header { display: flex; align-items: center; justify-content: space-between; padding: .5rem 1rem; border-bottom: 1px solid var(--gray-200); font-size: .9rem; }
.plan-panel-header-actions { display: flex; align-items: center; gap: .5rem; }
.plan-panel-body { flex: 1; overflow: hidden; padding: .6rem 1rem; }
.plan-panel-cols { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(240px, 1fr) minmax(320px, 2.5fr); gap: 1rem; height: 100%; }
.plan-col { display: flex; flex-direction: column; gap: .5rem; min-width: 0; min-height: 0; }
.plan-col-meta { overflow-y: auto; }
.plan-col-stops .plan-sel-list { max-height: none; flex: 1; overflow-y: auto; }
.plan-col-route .plan-route-info { max-height: none; height: 100%; overflow: auto; margin: 0; }
@media (max-width: 1100px) {
  .plan-panel-cols { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .plan-col-route { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .plan-panel-cols { grid-template-columns: 1fr; }
  .map-plan-panel { max-height: 60vh; }
}
.plan-selected-count { font-size: .75rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }
.plan-sel-list { display: flex; flex-direction: column; gap: .25rem; max-height: 180px; overflow-y: auto; }
.plan-sel-item { display: flex; align-items: center; justify-content: space-between; font-size: .75rem; padding: .3rem .5rem; background: var(--gray-50); border-radius: 4px; gap: .4rem; cursor: grab; transition: background .12s, transform .08s; user-select: none; }
.plan-sel-item:active { cursor: grabbing; }
.plan-sel-item.dragging { opacity: .4; background: #dbeafe; }
.plan-sel-item.drag-over { background: #bfdbfe; box-shadow: inset 0 -2px 0 #2563eb; }
.plan-sel-item .plan-sel-grip { color: var(--gray-400); font-weight: bold; font-size: .85rem; cursor: grab; flex-shrink: 0; }
.plan-sel-item .plan-sel-num { background: #1d4ed8; color: white; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; flex-shrink: 0; }
.plan-sel-item .plan-sel-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-sel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .68rem; }
.plan-sel-hint { color: var(--gray-500); font-style: italic; flex: 1; }
.plan-target-hint { background: #fef3c7; border-left: 3px solid #f59e0b; padding: .35rem .55rem; border-radius: 4px; font-size: .75rem; color: #78350f; margin-bottom: .35rem; }
.plan-target-hint.hidden { display: none; }
.btn-xs { padding: .2rem .5rem; font-size: .68rem; line-height: 1.2; border-radius: 4px; }
.plan-route-info { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: .5rem .65rem; font-size: .78rem; color: #1e40af; margin: .4rem 0; max-height: 140px; overflow-y: auto; }
.plan-route-info .route-summary { font-weight: 600; margin-bottom: .25rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.plan-route-info .route-tag { background: #2563eb; color: white; border-radius: 10px; padding: 1px 7px; font-size: .7rem; font-weight: 600; }
.plan-route-info .route-legs { border-top: 1px solid #bfdbfe; margin-top: .25rem; padding-top: .25rem; display: flex; flex-direction: column; gap: 2px; }
.plan-route-info .route-leg { font-size: .72rem; color: #3b4db8; }
.plan-route-info .route-warn { background: #fef2f2; border-left: 3px solid #dc2626; padding-left: .5rem; }
.plan-route-info .route-timeline { border-top: 1px solid #bfdbfe; margin-top: .35rem; padding-top: .35rem; display: flex; flex-direction: column; gap: 1px; }
.plan-route-info .route-timeline-title { font-size: .7rem; font-weight: 700; color: #1e40af; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .03em; }
.plan-route-info .timeline-row { display: grid; grid-template-columns: 42px 18px 1fr; gap: 4px; font-size: .72rem; align-items: center; padding: 2px 0; color: #1e3a8a; }
.plan-route-info .timeline-row .t-time { font-family: monospace; font-weight: 700; color: #1e40af; font-size: .73rem; }
.plan-route-info .timeline-row .t-icon { text-align: center; }
.plan-route-info .timeline-row.timeline-start { background: #ecfdf5; border-radius: 3px; padding: 3px 4px; }
.plan-route-info .timeline-row.timeline-end { background: #ecfdf5; border-radius: 3px; padding: 3px 4px; font-weight: 600; }
.plan-route-info .timeline-row.timeline-onsite { color: #6b7280; font-style: italic; }
.plan-route-info .leg-stop { font-weight: 600; }
/* Horizontale Tour-Timeline: Start → Fahrt → Termin → Fahrt → … → Ende */
.plan-route-info { max-height: 260px; }
.plan-route-info .route-timeline-h { display: flex; flex-direction: row; align-items: stretch; gap: .25rem; overflow-x: auto; padding: .5rem .25rem .25rem; border-top: 1px solid #bfdbfe; margin-top: .35rem; }
.plan-route-info .tl-node { flex: 0 0 auto; min-width: 110px; max-width: 160px; background: white; border: 1px solid #bfdbfe; border-radius: 6px; padding: .35rem .4rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.plan-route-info .tl-node.tl-start { background: #ecfdf5; border-color: #86efac; }
.plan-route-info .tl-node.tl-end { background: #ecfdf5; border-color: #86efac; }
.plan-route-info .tl-node.tl-appt { background: #eff6ff; }
.plan-route-info .tl-icon { font-size: 1.1rem; line-height: 1; }
.plan-route-info .tl-time { font-family: monospace; font-weight: 700; font-size: .72rem; color: #1e40af; }
.plan-route-info .tl-label { font-size: .68rem; line-height: 1.15; color: #1e3a8a; word-break: break-word; max-height: 2.5em; overflow: hidden; text-overflow: ellipsis; }
.plan-route-info .tl-sub { font-size: .62rem; color: #6b7280; }
.plan-route-info .tl-num { position: absolute; top: -7px; left: -7px; background: #2563eb; color: white; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 700; padding: 0 4px; }
.plan-route-info .tl-edge { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 50px; color: #6b7280; position: relative; padding: 0 .25rem; }
.plan-route-info .tl-edge::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: #93c5fd; z-index: 0; }
.plan-route-info .tl-edge-icon, .plan-route-info .tl-edge-time { position: relative; z-index: 1; background: #eff6ff; padding: 0 3px; }
.plan-route-info .tl-edge-icon { font-size: .9rem; }
.plan-route-info .tl-edge-time { font-size: .65rem; font-weight: 700; color: #1e40af; }
/* V2: Plan-Toolbar oben + interaktive Zeitachse */
.plan-panel-v2 { display: flex; flex-direction: column; gap: .5rem; height: 100%; overflow: hidden; }
.plan-panel-v2 .plan-route-info { flex: 1; max-height: none; height: auto; overflow: auto; margin: 0; }
.plan-toolbar { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; padding: .15rem 0; }
.plan-toolbar .plan-sel-count-box { background: #1d4ed8; color: white; padding: .35rem .65rem; border-radius: 4px; font-size: .8rem; font-weight: 600; align-self: center; }
.plan-toolbar-fields { display: flex; gap: .5rem; flex: 1; min-width: 0; max-width: 520px; }
.plan-toolbar-fields .form-group { flex: 1; min-width: 140px; margin: 0; }
.plan-toolbar-fields label { font-size: .68rem; color: var(--gray-600); margin-bottom: 2px; display: block; }
.plan-toolbar-fields .select-sm { width: 100%; }
.plan-toolbar-actions { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
/* Zeitachsen-Knoten interaktiv */
.plan-route-info .tl-node[draggable="true"] { cursor: grab; }
.plan-route-info .tl-node[draggable="true"]:active { cursor: grabbing; }
.plan-route-info .tl-node.tl-appt.dragging { opacity: .35; }
.plan-route-info .tl-node.tl-clickable { cursor: pointer; }
.plan-route-info .tl-node.tl-clickable:hover { box-shadow: 0 0 0 2px #2563eb; }
.plan-route-info .tl-node .tl-remove { position: absolute; top: -7px; right: -7px; background: #dc2626; color: white; border: none; border-radius: 999px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: .7rem; cursor: pointer; padding: 0; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.plan-route-info .tl-node .tl-remove:hover { background: #991b1b; }
.plan-route-info .tl-node .tl-edit-hint { position: absolute; bottom: -6px; right: 4px; background: #2563eb; color: white; border-radius: 3px; font-size: .55rem; padding: 1px 4px; font-weight: 700; opacity: 0; transition: opacity .12s; }
.plan-route-info .tl-node.tl-clickable:hover .tl-edit-hint { opacity: 1; }
.plan-route-info .tl-drop { flex: 0 0 auto; width: 8px; align-self: stretch; border-radius: 3px; transition: background .12s, width .12s; }
.plan-route-info .tl-drop.drag-over { background: #2563eb; width: 28px; }
/* Popover für Start/End-Auswahl */
.tl-popover { position: absolute; z-index: 5000; background: white; border: 1px solid var(--gray-300); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); padding: .35rem; min-width: 220px; max-height: 280px; overflow: auto; }
.tl-popover .tl-pop-title { font-size: .7rem; font-weight: 700; color: var(--gray-600); padding: .25rem .4rem; text-transform: uppercase; letter-spacing: .04em; }
.tl-popover .tl-pop-opt { display: block; width: 100%; text-align: left; background: none; border: none; padding: .4rem .5rem; border-radius: 4px; cursor: pointer; font-size: .8rem; color: #1e3a8a; }
.tl-popover .tl-pop-opt:hover { background: #eff6ff; }
.tl-popover .tl-pop-opt.active { background: #dbeafe; font-weight: 600; }
/* Mini calendar */
.map-mini-cal { flex-shrink: 0; background: white; border-top: 1px solid var(--gray-200); overflow-x: auto; overflow-y: auto; height: 200px; min-height: 60px; max-height: 80vh; position: relative; }
.mini-cal-resize { flex-shrink: 0; height: 8px; cursor: ns-resize; background: var(--gray-200); position: relative; z-index: 6; }
.mini-cal-resize::before { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 3px; background: var(--gray-400); border-radius: 2px; }
.mini-cal-resize:hover { background: var(--blue-light); }
.mini-cal-resize.dragging { background: var(--blue); }
.mini-cal-header { display: flex; align-items: center; gap: .5rem; padding: .4rem .75rem; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; left: 0; background: white; z-index: 6; }
.mini-cal-range { font-size: .8rem; font-weight: 700; color: var(--gray-700); flex: 1; text-align: center; }
.mini-cal-grid { display: grid; min-width: 900px; }
.mini-cal-tech-label { font-size: .65rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; padding: .35rem .5rem; background: var(--gray-50); border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); position: sticky; left: 0; top: 32px; z-index: 5; white-space: nowrap; box-shadow: 3px 0 6px -2px rgba(0,0,0,.12); clip-path: inset(0 -10px 0 0); }
.mini-cal-day-hdr { padding: .3rem .25rem; text-align: center; background: var(--gray-50); border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); font-size: .65rem; font-weight: 700; color: var(--gray-500); white-space: nowrap; position: sticky; top: 32px; z-index: 2; }
.mini-cal-day-hdr.today { color: var(--blue); }
.mini-cal-day-hdr.weekend { background: var(--gray-100); }
.mini-cal-cell { padding: .15rem .2rem; background: white; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); min-height: 34px; cursor: pointer; transition: background .1s; }
.mini-cal-cell:hover { background: var(--blue-light); }
.mini-cal-cell.weekend { background: var(--gray-50); }
.mini-cal-cell.plan-target { background: #dbeafe; outline: 2px solid var(--blue); outline-offset: -2px; }
.mini-cal-chip { border-radius: 3px; padding: .1rem .3rem; font-size: .6rem; font-weight: 600; color: white; margin-bottom: 1px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-cal-tech-name { font-size: .65rem; font-weight: 600; color: var(--gray-700); padding: .35rem .5rem; background: white; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); position: sticky; left: 0; z-index: 4; white-space: nowrap; display: flex; align-items: center; gap: .3rem; box-shadow: 3px 0 6px -2px rgba(0,0,0,.12); clip-path: inset(0 -10px 0 0); }


/* ── Appointments table ── */
.table-wrap { flex: 1; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: .6rem 1rem; text-align: left; font-size: .7rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.data-table th.sortable:hover { color: var(--blue); background: var(--blue-light); }
.data-table th.sortable .sort-icon { opacity: .4; font-style: normal; margin-left: .2rem; }
.data-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--gray-100); font-size: .8rem; color: var(--gray-700); vertical-align: middle; }
.data-table tr:hover td { background: var(--gray-50); }
.badge { display: inline-flex; align-items: center; padding: .2rem .5rem; border-radius: 99px; font-size: .7rem; font-weight: 700; }
.badge-blue { background: var(--blue-light); color: var(--blue-dark); }
.badge-green { background: #f0fdf4; color: #166534; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-orange { background: #fff7ed; color: #9a3412; }
.filter-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.bulk-bar { display: flex; align-items: center; gap: .75rem; padding: .625rem 1.25rem; background: var(--blue-light); border-top: 1px solid var(--blue); color: var(--blue-dark); font-size: .8rem; font-weight: 600; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; color: var(--gray-400); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; }

/* ── Technician grid ── */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; padding: 1.25rem; overflow-y: auto; }
.tech-card { background: white; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 1rem 1.25rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: .875rem; cursor: pointer; transition: box-shadow .15s; }
.tech-card:hover { box-shadow: var(--shadow-md); }
.tech-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .875rem; color: white; flex-shrink: 0; }
.tech-info { flex: 1; min-width: 0; }
.tech-info strong { display: block; font-size: .875rem; color: var(--gray-800); }
.tech-info small { color: var(--gray-500); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tech-card-add { border: 2px dashed var(--gray-300); background: transparent; }
.tech-card-add:hover { border-color: var(--blue); background: var(--blue-light); }

/* ── Import ── */
.import-flow { padding: 1.25rem; max-width: 720px; overflow-y: auto; flex: 1; }
.import-step { margin-bottom: 1.5rem; }
.step-label { display: flex; align-items: center; gap: .625rem; font-size: .875rem; font-weight: 700; color: var(--gray-700); margin-bottom: .875rem; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.drop-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 2.5rem; text-align: center; cursor: pointer; transition: all .2s; position: relative; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--blue); background: var(--blue-light); }
.drop-zone svg { width: 40px; height: 40px; color: var(--gray-400); margin-bottom: .75rem; }
.drop-zone p { color: var(--gray-600); font-size: .875rem; }
.drop-zone small { color: var(--gray-400); font-size: .75rem; }
.drop-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.mapping-item label { display: block; font-size: .7rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.mapping-actions { display: flex; gap: .5rem; }
.progress-bar-wrap { background: var(--gray-200); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 99px; transition: width .3s ease; }
.progress-text { font-size: .8rem; color: var(--gray-600); margin-top: .5rem; }
.import-result { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.import-stat { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: .75rem 1rem; text-align: center; }
.import-stat .stat-val { font-size: 1.5rem; font-weight: 700; }
.import-stat .stat-lbl { font-size: .7rem; color: var(--gray-500); text-transform: uppercase; }
.failure-table-wrap { max-height: 240px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: .5rem; }
.failure-table-wrap table { width: 100%; border-collapse: collapse; }
.failure-table-wrap th { padding: .4rem .6rem; font-size: .65rem; font-weight: 700; text-transform: uppercase; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; }
.failure-table-wrap td { padding: .4rem .6rem; font-size: .75rem; border-bottom: 1px solid var(--gray-100); }
.failure-table-wrap input { border: 1px solid var(--gray-300); border-radius: 4px; padding: .2rem .4rem; font-size: .75rem; width: 100%; }
.import-final-actions { display: flex; gap: .5rem; margin-top: 1.25rem; }

/* ── Import Confirm Panel ── */
.import-confirm-panel { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: .75rem 1rem; margin-top: .75rem; }
.iprev-title { font-size: .8rem; font-weight: 600; color: #1e40af; margin-bottom: .5rem; }
.iprev-title em { font-style: normal; font-family: ui-monospace, monospace; }
.iprev-stats { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .65rem; }
.iprev-stat { font-size: .8rem; padding: .25rem .6rem; border-radius: 20px; font-weight: 500; }
.iprev-new   { background: #dcfce7; color: #166534; }
.iprev-upd   { background: #dbeafe; color: #1e40af; }
.iprev-ident { background: #f3f4f6; color: #4b5563; }
.iprev-skip  { background: #fef3c7; color: #92400e; }
.import-confirm-actions { display: flex; gap: .5rem; }

/* ── Duration Conflict Resolution ── */
#importDurConflicts { margin: .75rem 0; padding: .75rem; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; }
.idur-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; font-size: .82rem; font-weight: 600; color: #92400e; }
.idur-bulk { display: flex; gap: .4rem; }
.idur-list { display: flex; flex-direction: column; gap: .4rem; max-height: 280px; overflow-y: auto; }
.idur-row { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .5rem .6rem; background: white; border: 1px solid #fde68a; border-radius: 6px; }
.idur-name { font-weight: 600; font-size: .82rem; flex: 1; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idur-on { font-size: .72rem; color: var(--gray-400); font-family: ui-monospace, monospace; white-space: nowrap; }
.idur-btn { padding: 3px 10px; font-size: .78rem; border-radius: 5px; border: 1px solid var(--gray-300); cursor: pointer; background: white; transition: background .12s, border-color .12s; white-space: nowrap; }
.idur-btn:hover { background: var(--gray-100); }
.idur-btn.idur-chosen { background: #d1fae5; border-color: #6ee7b7; color: #065f46; font-weight: 700; }
.idur-btn.idur-import-btn.idur-import-active { background: #dbeafe; border-color: #93c5fd; color: #1e40af; font-weight: 700; }
.idur-warning { margin-top: .5rem; font-size: .78rem; color: #92400e; background: #fef3c7; padding: 4px 8px; border-radius: 4px; }
.idur-ok { margin-top: .5rem; font-size: .78rem; color: #065f46; background: #d1fae5; padding: 4px 8px; border-radius: 4px; }

/* ── Import History ── */
.import-history { margin-top: 1rem; }
.import-history-title { font-size: .7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.import-log-row { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; background: white; border: 1px solid var(--gray-200); border-radius: 6px; margin-bottom: .3rem; font-size: .75rem; flex-wrap: wrap; }
.ilog-file { flex: 1; font-weight: 600; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ilog-type { color: #1d4ed8; font-size: .7rem; background: #dbeafe; padding: .1rem .4rem; border-radius: 10px; flex-shrink: 0; }
.ilog-date { color: var(--gray-500); font-size: .7rem; flex-shrink: 0; }
.ilog-user { color: var(--gray-500); font-size: .7rem; flex-shrink: 0; }
.ilog-counts { display: flex; gap: .25rem; flex-shrink: 0; }
.ilog-counts span { font-size: .68rem; font-weight: 700; padding: .1rem .3rem; border-radius: 4px; }
.ilog-new  { background: #dcfce7; color: #166534; }
.ilog-upd  { background: #dbeafe; color: #1e40af; }
.ilog-ident { background: #f3f4f6; color: #4b5563; }
.ilog-skip  { background: #fef3c7; color: #92400e; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; padding: 1.25rem; overflow-y: auto; align-content: start; }
.settings-card { background: white; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 1.25rem; box-shadow: var(--shadow); }
.settings-card h3 { font-size: .9rem; font-weight: 700; color: var(--gray-800); margin-bottom: 1rem; }
.settings-card h4 { font-size: .8rem; font-weight: 700; color: var(--gray-700); margin-bottom: .75rem; }
.settings-form .form-group { margin-bottom: .75rem; }
.danger-zone { border-color: #fca5a5; }
.danger-zone h3 { color: var(--red); }
.danger-zone p { font-size: .8rem; color: var(--gray-600); margin-bottom: 1rem; }

/* ── Users list ── */
.user-item { display: flex; align-items: center; justify-content: space-between; padding: .5rem .625rem; border-radius: 6px; }
.user-item:hover { background: var(--gray-50); }
.user-name { font-weight: 600; font-size: .8rem; }
.user-role { font-size: .7rem; color: var(--gray-500); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
/* Detail-Modals die über anderen Modals erscheinen sollen */
#apptDetailModal { z-index: 1200; }
#calDayModal     { z-index: 1200; }
.modal { background: white; border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; }
.modal-lg { max-width: 900px; }
.modal-wide { max-width: 760px; }
.detail-header { background: var(--gray-50); border-radius: 8px; padding: .65rem .85rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: .75rem; border-left: 4px solid var(--gray-300); }
.detail-header .dh-main { flex: 1; min-width: 0; }
.detail-header .dh-title { font-weight: 700; font-size: .92rem; color: var(--gray-900); }
.detail-header .dh-address { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }
.detail-header .dh-meta { display: flex; gap: .5rem; font-size: .72rem; color: var(--gray-600); margin-top: .35rem; flex-wrap: wrap; align-items: center; }
.detail-header .dh-badge { padding: 2px 7px; border-radius: 4px; color: white; font-weight: 600; font-size: .7rem; }
.detail-header .dh-ordernum { display: flex; align-items: center; gap: .35rem; background: white; border: 1px solid var(--gray-200); border-radius: 5px; padding: 2px 8px; font-family: monospace; font-weight: 700; font-size: .78rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-col { display: flex; flex-direction: column; gap: .75rem; }
.detail-fieldset { border: 1px solid var(--gray-200); border-radius: 8px; padding: .85rem 1rem 1rem; margin: 0; }
.detail-fieldset legend { font-size: .8rem; font-weight: 700; color: var(--gray-600); padding: 0 .45rem; letter-spacing: .01em; }
.detail-fieldset .form-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .45rem; }
.detail-fieldset .form-row:last-child { margin-bottom: 0; }
/* Farbakzente je Sektion (left-border + Legende-Farbe) */
.detail-fieldset:has(#spMaterial), .detail-fieldset:has(#dtMaterial) { border-left: 3px solid #f59e0b; }
.detail-fieldset:has(#spMaterial) legend, .detail-fieldset:has(#dtMaterial) legend { color: #b45309; }
.detail-fieldset:has(#spBuehneNeeded), .detail-fieldset:has(#dtBuehneNeeded) { border-left: 3px solid #3b82f6; }
.detail-fieldset:has(#spBuehneNeeded) legend, .detail-fieldset:has(#dtBuehneNeeded) legend { color: #1d4ed8; }
.detail-fieldset:has(#spAnnouncementMethod), .detail-fieldset:has(#dtAnnouncementMethod) { border-left: 3px solid #10b981; }
.detail-fieldset:has(#spAnnouncementMethod) legend, .detail-fieldset:has(#dtAnnouncementMethod) legend { color: #065f46; }
.checkbox-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; cursor: pointer; user-select: none; padding: .25rem .35rem; border-radius: 4px; }
.checkbox-label input[type=checkbox] { margin: 0; cursor: pointer; }
.audit-info { font-size: .68rem; color: var(--gray-400); margin-top: 2px; min-height: 14px; font-style: italic; }
.audit-info:empty { display: none; }
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.modal-header h3 { font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.modal-close { flex: none; width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 8px; color: var(--gray-500); font-size: 1.25rem; line-height: 1; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.modal-close:hover { background: #fee2e2; border-color: #fecaca; color: #dc2626; }
.modal-close:active { transform: scale(.94); }
.modal-close.btn-icon { background: var(--gray-100); border: 1px solid var(--gray-200); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; align-items: center; gap: .625rem; padding: 1rem 1.25rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); flex-shrink: 0; }

/* ── Tour modal layout ── */
.tour-modal-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; height: 500px; }
.tour-stops-col { display: flex; flex-direction: column; overflow: hidden; }
.tour-info-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; margin-bottom: .75rem; flex-shrink: 0; }
.tour-info-row .form-group { margin: 0; }
.tour-tech-badge { font-size: .8rem; font-weight: 600; }
.tour-map-col { display: flex; flex-direction: column; }
.tour-map { flex: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gray-200); }
.route-info { margin-top: .5rem; font-size: .75rem; color: var(--gray-600); }
.stop-list { flex: 1; overflow-y: auto; margin-bottom: .5rem; }
.stop-item { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem; border-radius: 6px; border: 1px solid var(--gray-200); margin-bottom: .3rem; background: white; cursor: grab; }
.stop-item:hover { background: var(--gray-50); }
.stop-num { font-size: .7rem; font-weight: 700; color: var(--gray-400); min-width: 16px; }
.stop-info { flex: 1; min-width: 0; }
.stop-info strong { display: block; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-info small { color: var(--gray-500); font-size: .7rem; }
.stop-done { width: 14px; height: 14px; }
.tour-stop-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.tour-tech-color { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; }

/* ── Pick list ── */
.pick-list { max-height: 350px; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: .625rem; padding: .5rem .625rem; border-radius: 6px; cursor: pointer; }
.pick-item:hover { background: var(--blue-light); }
.pick-item strong { font-size: .8rem; display: block; }
.pick-item small { font-size: .72rem; color: var(--gray-500); }

/* ── Leaflet overrides ── */
.leaflet-container { font-family: var(--font); }
.custom-marker-label { background: white; border: 1px solid var(--gray-300); border-radius: 4px; padding: 2px 5px; font-size: 11px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow); }

/* ── Appointment info popup ── */
.appt-info-popup-wrap .leaflet-popup-content-wrapper { border-radius: 10px; padding: 0; box-shadow: 0 4px 20px rgba(0,0,0,.18); border: 1px solid var(--gray-200); }
.appt-info-popup-wrap .leaflet-popup-content { margin: 0; width: auto !important; }
.appt-info-popup { font-family: var(--font); font-size: .8rem; min-width: 220px; }
.appt-popup-header { padding: .65rem .8rem .5rem; border-bottom: 1px solid var(--gray-100); }
.appt-popup-type-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.appt-popup-type { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.popup-edit-btn { background: var(--gray-100); border: 1px solid var(--gray-300); border-radius: 5px; padding: 2px 8px; font-size: .68rem; cursor: pointer; color: var(--gray-700); white-space: nowrap; }
.popup-edit-btn:hover { background: var(--blue-100, #dbeafe); border-color: var(--blue-500, #3b82f6); color: var(--blue-700, #1d4ed8); }
.appt-popup-details { margin-top: .4rem; padding-top: .35rem; border-top: 1px dashed var(--gray-200); display: flex; flex-direction: column; gap: 2px; }
.popup-detail-line { font-size: .72rem; color: var(--gray-700); display: flex; gap: .35rem; align-items: flex-start; }
.popup-detail-line strong { font-size: .85em; flex-shrink: 0; }
.appt-popup-title { font-weight: 700; font-size: .88rem; color: var(--gray-900); line-height: 1.2; }
.appt-popup-address { color: var(--gray-500); font-size: .75rem; margin-top: 2px; }
.appt-popup-assigned { margin-top: .3rem; display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: var(--gray-600); }
.appt-popup-ordernum { display: flex; align-items: center; gap: .4rem; padding: .45rem .8rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.popup-label { font-size: .68rem; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; flex-shrink: 0; }
.popup-ordernum-val { font-weight: 700; color: var(--gray-900); font-size: .82rem; flex: 1; font-family: monospace; }
.popup-copy-btn { background: none; border: 1px solid var(--gray-300); border-radius: 5px; cursor: pointer; padding: 2px 5px; color: var(--gray-500); display: flex; align-items: center; transition: all .15s; flex-shrink: 0; }
.popup-copy-btn:hover { background: var(--gray-100); color: var(--gray-800); border-color: var(--gray-400); }
.appt-popup-techs { padding: .5rem .8rem .65rem; }
.appt-popup-techs .popup-label { display: block; margin-bottom: .35rem; }
.popup-tech-row { display: grid; grid-template-columns: 18px 10px 1fr auto auto; align-items: center; gap: .3rem .45rem; padding: .22rem 0; border-bottom: 1px solid var(--gray-100); }
.popup-tech-row:last-child { border-bottom: none; }
.popup-tech-selectable { cursor: pointer; border-radius: 5px; padding: .28rem .35rem; transition: background .12s; }
.popup-tech-selectable:hover { background: #eff6ff; }
.popup-tech-selectable .popup-tech-arrow { color: var(--gray-300); font-size: 1rem; line-height: 1; }
.popup-tech-selected { background: #dbeafe !important; }
.popup-tech-selected .popup-tech-arrow { color: #2563eb !important; font-weight: 700; }
.popup-assign-ui { border-top: 1px solid var(--gray-200); padding: .5rem .8rem .6rem; background: #f0f9ff; }
.popup-assign-header { display: flex; align-items: center; gap: .4rem; font-size: .78rem; margin-bottom: .4rem; flex-wrap: wrap; }
.popup-assign-row { display: flex; gap: .4rem; align-items: center; }
.popup-assign-date { flex: 1; font-size: .78rem; padding: .3rem .4rem; border: 1px solid var(--gray-300); border-radius: 5px; font-family: var(--font); }
.popup-assign-btn { background: #2563eb; color: white; border: none; border-radius: 5px; padding: .3rem .7rem; font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s; }
.popup-assign-btn:hover { background: #1d4ed8; }
.popup-assign-hint { font-size: .68rem; color: var(--gray-400); margin-top: .3rem; text-align: center; }
.mini-cal-cell.pending-assign-target { background: #dbeafe !important; outline: 2px solid #2563eb; outline-offset: -2px; cursor: pointer; }
.popup-tech-rank { font-size: .8rem; }
.popup-tech-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.popup-tech-name { font-weight: 600; color: var(--gray-800); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-tech-dist { font-size: .72rem; color: var(--gray-500); text-align: right; white-space: nowrap; }
.popup-tech-time { font-weight: 700; color: var(--gray-900); font-size: .76rem; text-align: right; white-space: nowrap; }
.popup-tech-loading { color: var(--gray-400); font-size: .76rem; padding: .3rem 0; }
.popup-tech-none { color: var(--gray-400); font-size: .76rem; padding: .3rem 0; font-style: italic; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 52px; }
  .sidebar-logo span, .nav-link span, .sidebar-user span { display: none; }
  .nav-link { justify-content: center; padding: .6rem; }
  .sidebar-logo { justify-content: center; padding: .875rem .5rem; }
  .tour-modal-layout { grid-template-columns: 1fr; height: auto; }
  .tour-map-col { display: none; }
}

/* ── Appointment Side-Panel (slides in from right on map view) ── */
.appt-side-panel {
  width: 380px; background: white; border-left: 1px solid var(--gray-200);
  display: flex; flex-direction: column; flex-shrink: 0; box-shadow: -4px 0 12px rgba(0,0,0,.08);
  animation: slideInRight .22s ease-out;
}
.appt-side-panel.hidden { display: none; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.side-panel-header { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.side-panel-header .sp-type-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.side-panel-header .sp-type { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.side-panel-header .sp-close { background: none; border: 1px solid var(--gray-300); border-radius: 5px; cursor: pointer; padding: 2px 8px; color: var(--gray-600); font-size: .9rem; }
.side-panel-header .sp-close:hover { background: var(--gray-100); }
.side-panel-header .sp-title { font-weight: 700; font-size: .92rem; color: var(--gray-900); line-height: 1.25; }
.side-panel-header .sp-address { font-size: .76rem; color: var(--gray-500); margin-top: 2px; }
.side-panel-header .sp-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .35rem; font-size: .72rem; }
.side-panel-header .sp-ordernum { display: flex; align-items: center; gap: .35rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 5px; padding: 2px 8px; font-family: monospace; font-weight: 700; font-size: .74rem; cursor: pointer; }
.side-panel-header .sp-ordernum:hover { background: var(--gray-100); }
/* Group-Nav: Wechsel zwischen mehreren Aufträgen an gleicher Adresse */
.side-panel-header .sp-group-nav {
  display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
  margin: -.25rem -.25rem .5rem; padding: .35rem .5rem;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
}
.sp-group-nav .sp-gn-arrow {
  background: white; border: 1px solid #93c5fd; color: #1e3a8a;
  border-radius: 4px; cursor: pointer; padding: 0 .45rem;
  font-size: 1rem; line-height: 1.4; font-weight: 700;
}
.sp-group-nav .sp-gn-arrow:hover { background: #dbeafe; }
.sp-group-nav .sp-gn-label { font-size: .72rem; font-weight: 700; color: #1e3a8a; }
.sp-group-nav .sp-gn-pills { display: flex; flex-wrap: wrap; gap: 3px; flex: 1 1 100%; margin-top: .15rem; }
.sp-group-nav .sp-gn-pill {
  --pill-c: #6b7280;
  background: white; border: 1.5px solid var(--pill-c); color: var(--pill-c);
  border-radius: 10px; cursor: pointer; padding: 1px 7px;
  font-size: .7rem; font-weight: 700; line-height: 1.3;
  display: inline-flex; align-items: center; gap: 3px;
}
.sp-group-nav .sp-gn-pill:hover { filter: brightness(.95); }
.sp-group-nav .sp-gn-pill.active { background: var(--pill-c); color: white; box-shadow: 0 0 0 2px #dbeafe; }
.sp-group-nav .sp-gn-pill .sp-gn-dot { font-size: .55rem; color: #16a34a; }
.sp-group-nav .sp-gn-pill.active .sp-gn-dot { color: white; }
.side-panel-body { flex: 1; overflow-y: auto; padding: .85rem 1rem; display: flex; flex-direction: column; gap: 1.1rem; }
.side-panel-footer { padding: .65rem 1rem; border-top: 1px solid var(--gray-200); display: flex; flex-wrap: wrap; gap: .4rem; flex-shrink: 0; background: var(--gray-50); max-height: 40vh; overflow-y: auto; }
.side-panel-footer .btn { flex: 1 1 calc(50% - .4rem); min-width: 0; padding-left: .4rem; padding-right: .4rem; font-size: .82rem; }
.sp-section { display: flex; flex-direction: column; gap: .35rem; }
.sp-section-title { font-size: .72rem; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: .03em; }
.sp-label { font-size: .72rem; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 2px; }
.sp-techs { display: flex; flex-direction: column; gap: 3px; }
.sp-techs .popup-tech-row { display: flex; align-items: center; gap: .4rem; padding: .35rem .5rem; border-radius: 5px; cursor: pointer; font-size: .78rem; background: var(--gray-50); border: 1px solid var(--gray-200); transition: all .15s; }
.sp-techs .popup-tech-row:hover { background: white; border-color: var(--blue-500, #3b82f6); transform: translateX(-2px); box-shadow: -2px 0 0 var(--blue-500, #3b82f6); }
.sp-techs .popup-tech-rank { font-size: .85em; flex-shrink: 0; width: 20px; text-align: center; }
.sp-techs .popup-tech-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sp-techs .popup-tech-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-techs .popup-tech-dist { font-size: .7rem; color: var(--gray-500); }
.sp-techs .popup-tech-time { font-size: .73rem; color: var(--gray-700); font-weight: 600; }
.sp-techs .popup-tech-arrow { color: var(--gray-400); font-weight: bold; }
.sp-techs .popup-tech-selected { background: #dbeafe; border-color: #3b82f6; }
.sp-techs .popup-tech-loading { font-size: .78rem; color: var(--gray-400); padding: .5rem; text-align: center; font-style: italic; }
.sp-techs .popup-tech-none { font-size: .78rem; color: var(--gray-400); padding: .5rem; text-align: center; font-style: italic; }
@media (max-width: 1100px) { .appt-side-panel { width: 340px; } }
@media (max-width: 900px) { .appt-side-panel { width: 300px; } }
@media (max-width: 700px) { .appt-side-panel { width: 260px; } }

/* ── Verteilen-Modal: Trello-Board ── */
.dist-board { display: flex; gap: .6rem; overflow-x: auto; padding: .25rem 0 .5rem; min-height: 200px; }
.dist-day { flex: 0 0 280px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; display: flex; flex-direction: column; max-height: 70vh; }
.dist-day.dist-overflow { background: #fef3c7; border-color: #f59e0b; }
.dist-day-header { padding: .5rem .65rem; border-bottom: 1px solid var(--gray-200); display: flex; flex-direction: column; gap: .15rem; flex-shrink: 0; }
.dist-day-date { font-weight: 700; font-size: .82rem; color: var(--gray-900); }
.dist-day-meta { font-size: .72rem; color: var(--gray-600); display: flex; justify-content: space-between; align-items: center; }
.dist-day-bar { height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden; margin-top: .2rem; }
.dist-day-bar-fill { height: 100%; background: #22c55e; transition: width .2s, background .2s; }
.dist-day-bar-fill.warn { background: #f59e0b; }
.dist-day-bar-fill.over { background: #ef4444; }
.dist-day-map { height: 160px; width: 100%; background: #e5e7eb; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; position: relative; z-index: 0; }
.dist-day-map .leaflet-control-zoom { box-shadow: 0 1px 3px rgba(0,0,0,.3); border: none; }
.dist-day-map .leaflet-control-zoom a { width: 22px; height: 22px; line-height: 22px; font-size: 14px; }
.dist-day-map-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: #6b7280; font-size: .75rem; font-style: italic; }
.dist-day-stops { padding: .4rem; flex: 1; overflow-y: auto; min-height: 60px; display: flex; flex-direction: column; gap: .35rem; }
.dist-day-stops.drag-over { background: #dbeafe; }
.dist-stop { background: white; border: 1px solid var(--gray-200); border-left: 3px solid #6b7280; border-radius: 5px; padding: .4rem .5rem; cursor: grab; font-size: .78rem; user-select: none; }
.dist-stop:active { cursor: grabbing; }
.dist-stop.dragging { opacity: .4; }
.dist-stop-name { font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-stop-meta { font-size: .7rem; color: var(--gray-600); display: flex; justify-content: space-between; margin-top: 2px; }
.dist-stop-addr { font-size: .68rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-day-overnight { font-size: .7rem; font-weight: 600; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; padding: 2px 6px; border-radius: 4px; align-self: flex-start; }
.dist-day-end-label { font-size: .7rem; font-weight: 600; color: #475569; display: flex; align-items: center; gap: .3rem; align-self: stretch; }
.dist-day-end-select { flex: 1; min-width: 0; font-size: .72rem; padding: 2px 4px; border-radius: 4px; border: 1px solid #cbd5e1; background: #f8fafc; color: #334155; cursor: pointer; font-family: inherit; }
.dist-day-end-select:hover { border-color: #94a3b8; }
.dist-day-end-select.dist-day-end-override { background: #dbeafe; color: #1e40af; border-color: #60a5fa; font-weight: 700; }
.dist-day-end-info { font-size: .7rem; font-weight: 600; color: #64748b; align-self: flex-start; padding: 2px 6px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 4px; }
.dist-transfer { font-size: .72rem; font-weight: 600; padding: .25rem .55rem; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; margin: 1px 0; }
.dist-hinfahrt { background: #eff6ff; color: #1d4ed8; border: 1px dashed #93c5fd; }
.dist-rueckfahrt { background: #f0fdf4; color: #15803d; border: 1px dashed #86efac; }
/* Calendar memo chips */
.memo-chip { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-left: 3px solid #f59e0b; border-radius: 4px; padding: 2px 6px; font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; margin-bottom: 2px; }
.memo-chip:hover { background: #fde68a; }
.memo-drag-highlight { background: #fef9c3 !important; outline: 2px dashed #f59e0b; }
/* Brückentage panel */
.dist-bruecke-panel { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: .75rem 1rem; margin-bottom: .75rem; }
.bruecke-header { font-weight: 700; font-size: .88rem; color: #92400e; margin-bottom: .5rem; }
.bruecke-body { display: flex; flex-direction: column; gap: .45rem; }
.bruecke-checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.bruecke-check { display: flex; align-items: center; gap: .35rem; background: white; border: 1px solid #fcd34d; border-radius: 6px; padding: .3rem .6rem; font-size: .82rem; cursor: pointer; }
.bruecke-check input { accent-color: #f59e0b; cursor: pointer; }
.bruecke-reason { color: #b45309; font-size: .75rem; }
.bruecke-hint { font-size: .75rem; color: #92400e; }
.bruecke-actions { display: flex; gap: .5rem; }
.bruecke-info { font-size: .82rem; color: #92400e; display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
.cal-day-ordernums { display: flex; gap: .4rem; align-items: stretch; }
.cal-day-ordernums input { flex: 1; padding: .55rem .65rem; border: 1px solid var(--gray-300); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: #f9fafb; }
.cal-day-list { margin-top: .8rem; display: flex; flex-direction: column; gap: .35rem; }
.cal-day-list .cdl-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-left-width: 3px; border-radius: 5px; font-size: .82rem; }
.cal-day-list .cdl-on { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--gray-900); cursor: pointer; }
.cal-day-list .cdl-on:hover { color: #2563eb; text-decoration: underline; }
.cal-day-list .cdl-name { flex: 1; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day-list .cdl-time { font-size: .72rem; color: var(--gray-500); font-weight: 600; }
.cal-day-list .cdl-ort { font-size: .7rem; color: var(--gray-400); font-weight: 400; margin-left: .3rem; }
.cal-day-list .cdl-status { font-size: .65rem; font-weight: 700; color: white; background: var(--wf-c, #9ca3af); border-radius: 10px; padding: .1rem .45rem; white-space: nowrap; flex-shrink: 0; }
.cal-day-list .cdl-icon { font-size: .72rem; flex-shrink: 0; border-radius: 4px; padding: .05rem .25rem; line-height: 1.4; }
.cal-day-list .cdl-icon-ok  { background: #dcfce7; color: #166534; }
.cal-day-list .cdl-icon-warn { background: #fef9c3; color: #854d0e; }
.cal-day-info { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #1d4ed8; background: #3b82f6; color: white; font-size: 11px; font-weight: 700; font-family: Georgia, serif; font-style: italic; line-height: 1; padding: 0; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2); display: flex; align-items: center; justify-content: center; z-index: 2; }
.cal-day-info:hover { background: #1d4ed8; transform: scale(1.15); }
/* View-toggle buttons */
.cal-view-btn.cal-view-active { background: var(--blue); color: white; border-color: var(--blue); }
/* Drag & Drop */
.appt-chip.dragging { opacity: .3; }
.cal-cell.drag-over { background: rgba(59,130,246,.12) !important; outline: 2px dashed #3b82f6; outline-offset: -2px; }
/* Chip detail line (compact views) */
.appt-chip.chip-wide { white-space: normal; }
.appt-chip .chip-detail { display: block; font-size: .6rem; color: var(--gray-500); margin-top: 1px; line-height: 1.2; }
.appt-chip .chip-addr { display: block; font-size: .6rem; color: var(--gray-400); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ESERP per-type copy rows */
.cdl-copy-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.cdl-copy-row input { flex: 1; padding: .45rem .6rem; border: 1px solid var(--gray-300); border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; background: #f9fafb; border-left: 3px solid var(--row-color, #9ca3af); }
.cdl-copy-row .cdl-copy-label { font-size: .7rem; font-weight: 700; color: var(--row-color, #9ca3af); white-space: nowrap; min-width: 5rem; }

/* Bühnenarten Tabelle in Einstellungen */
.buehne-types-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.buehne-types-table th, .buehne-types-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--gray-200); text-align: left; }
.buehne-types-table th { font-weight: 600; color: var(--gray-600); background: var(--gray-50); }
.buehne-types-table tr:hover { background: #f8fafc; }
.buehne-types-table .bt-actions { display: flex; gap: .25rem; }
.settings-help { font-size: .78rem; color: var(--gray-500); margin: 0 0 .5rem; }
.settings-help code { background: var(--gray-100); padding: 1px 5px; border-radius: 3px; font-size: .72rem; color: #1e40af; }

/* ── Workflow-Status-Leiste ── */
.wf-status-bar { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; padding: .45rem .6rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: .75rem; }
.wf-step { border: none; background: none; padding: .25rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 600; cursor: pointer; transition: all .15s; color: var(--gray-400); border: 1.5px solid var(--gray-200); white-space: nowrap; }
.wf-step.wf-past { color: #6b7280; background: #f3f4f6; border-color: #d1d5db; }
.wf-step.wf-active { color: white; background: var(--wf-c, #3b82f6); border-color: var(--wf-c, #3b82f6); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.wf-step.wf-future { color: var(--gray-300); border-color: var(--gray-200); }
.wf-step:hover:not(.wf-active) { background: var(--gray-100); color: var(--gray-700); }
.wf-arr { color: var(--gray-300); font-size: .8rem; flex-shrink: 0; }
.wf-flags { display: flex; gap: .5rem; margin-left: auto; font-size: .75rem; color: var(--gray-600); }
.wf-flags label { display: flex; align-items: center; gap: 3px; cursor: pointer; }
/* Compact version for side panel */
.wf-status-bar-compact { padding: .3rem .4rem; gap: .2rem; }
.wf-status-bar-compact .wf-step { padding: .2rem .4rem; font-size: .7rem; }
.wf-flags-compact { gap: .35rem; }

/* ── Techniker-Tätigkeiten Dropdown ── */
.tech-skills-details { margin-top: .3rem; font-size: .78rem; }
.tech-skills-summary { cursor: pointer; font-size: .72rem; color: #2563eb; font-weight: 600; list-style: none; outline: none; }
.tech-skills-summary::-webkit-details-marker { display: none; }
.tech-skills-summary::before { content: '▸ '; font-size: .65rem; }
details[open] .tech-skills-summary::before { content: '▾ '; }
.tech-skills-details[open] { padding-top: .2rem; }

/* chip-flags small icons */
.chip-flags { font-size: .65rem; line-height: 1; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   ARBEITSBÜHNEN VIEW
   ══════════════════════════════════════════════════════ */
.buehnen-tabs { display: flex; gap: .25rem; padding: .5rem 1rem 0; border-bottom: 2px solid var(--gray-200); }
.buehnen-tab { background: none; border: none; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; color: var(--gray-500); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 4px 4px 0 0; transition: color .15s; }
.buehnen-tab:hover { color: var(--blue); background: var(--blue-light); }
.buehnen-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.buehnen-tab-content { display: none; padding: 0; }
.buehnen-tab-content.active { display: block; }
/* Status badges */
.bh-badge-ok  { display: inline-block; background: #dcfce7; color: #166534; font-size: .7rem; font-weight: 700; border-radius: 10px; padding: .1rem .5rem; white-space: nowrap; }
.bh-badge-warn { display: inline-block; background: #fef9c3; color: #854d0e; font-size: .7rem; font-weight: 700; border-radius: 10px; padding: .1rem .5rem; white-space: nowrap; }
/* Timeline container */
.bht-container { overflow-x: auto; padding: 1rem; }
.bht-axis { display: flex; margin-left: 200px; margin-bottom: 4px; }
.bht-axis-tick { flex: 1; font-size: .65rem; color: var(--gray-400); text-align: center; border-left: 1px dashed var(--gray-200); min-width: 28px; }
.bht-row { display: flex; align-items: center; margin-bottom: 4px; min-height: 28px; }
.bht-label { width: 200px; flex-shrink: 0; font-size: .78rem; color: var(--gray-700); padding-right: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.bht-label:hover { color: var(--blue); text-decoration: underline; }
.bht-track { flex: 1; position: relative; height: 22px; background: var(--gray-50); border-radius: 3px; border: 1px solid var(--gray-200); }
.bht-bar { position: absolute; top: 2px; height: 18px; border-radius: 3px; cursor: pointer; display: flex; align-items: center; padding: 0 6px; font-size: .65rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: opacity .1s; }
.bht-bar:hover { opacity: .85; }
.bht-bar.bh-ordered { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.bht-bar.bh-needed  { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.bht-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #ef4444; opacity: .6; z-index: 2; pointer-events: none; }
.bht-month-sep { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--gray-300); }

/* ══════════════════════════════════════════════════════
   AUTOMATISCHER PLAN
   ══════════════════════════════════════════════════════ */
.modal-xl { max-width: 95vw; width: 1100px; }

/* Config bar */
.ap-modal-body { display: flex; flex-direction: column; gap: 1rem; padding: 1rem 1.25rem; max-height: 82vh; overflow: hidden; }
.ap-config-bar { display: flex; align-items: flex-end; gap: 1.25rem; flex-wrap: wrap; padding: .75rem 1rem; background: var(--gray-50); border-radius: 8px; border: 1px solid var(--gray-200); }
.ap-config-item { display: flex; flex-direction: column; gap: .3rem; }
.ap-config-item label { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; }
.ap-pool-radios { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; }
.ap-pool-radios label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.ap-tech-checks { display: flex; gap: .5rem; flex-wrap: wrap; }
.ap-tech-check-label { display: flex; align-items: center; gap: .35rem; font-size: .85rem; cursor: pointer; padding: .2rem .5rem; border-radius: 12px; border: 1.5px solid var(--gray-200); background: #fff; transition: border-color .15s; }
.ap-tech-check-label:has(input:checked) { border-color: var(--blue); background: var(--blue-light); }
.ap-tech-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Loading */
.ap-loading { display: flex; align-items: center; gap: .75rem; padding: 1.5rem; color: var(--gray-500); }

/* Result wrapper */
.ap-result-wrap { display: flex; flex-direction: column; gap: .75rem; overflow: hidden; }
.ap-result-toolbar { display: flex; align-items: center; justify-content: space-between; padding: .5rem .25rem; }
.ap-summary-text { font-size: .88rem; color: var(--gray-600); }
.ap-result-actions { display: flex; gap: .5rem; }

/* Plan grid */
.ap-grid { overflow: auto; flex: 1; max-height: 55vh; border: 1px solid var(--gray-200); border-radius: 8px; }
.ap-grid-table { width: 100%; border-collapse: collapse; }
.ap-grid-table th { position: sticky; top: 0; background: var(--gray-50); font-size: .78rem; font-weight: 700; text-align: center; padding: .45rem .6rem; border-bottom: 2px solid var(--gray-200); white-space: nowrap; z-index: 2; }
.ap-grid-table th.ap-date-col { text-align: left; min-width: 90px; }
.ap-grid-table td { vertical-align: top; padding: .35rem .5rem; border-bottom: 1px solid var(--gray-100); min-width: 160px; }
.ap-grid-table td.ap-date-cell { font-size: .8rem; font-weight: 600; color: var(--gray-500); white-space: nowrap; background: var(--gray-50); }
.ap-grid-table tr:hover > td { background: #f8faff; }
.ap-drop-zone { min-height: 40px; border-radius: 6px; transition: background .15s; }
.ap-drop-zone.drag-over { background: var(--blue-light); outline: 2px dashed var(--blue); }

/* Chips */
.ap-chip { display: flex; align-items: center; gap: .3rem; background: #fff; border: 1.5px solid var(--gray-200); border-radius: 16px; padding: .2rem .55rem; font-size: .78rem; cursor: grab; margin-bottom: .3rem; user-select: none; transition: box-shadow .15s, border-color .15s; max-width: 200px; }
.ap-chip:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); border-color: var(--blue); }
.ap-chip:active { cursor: grabbing; }
.ap-chip.chip-service { border-left: 3px solid #ef4444; }
.ap-chip.chip-install  { border-left: 3px solid #7c3aed; }
.ap-chip.chip-wartung  { border-left: 3px solid #f59e0b; }
.ap-chip-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.ap-chip-travel { font-size: .68rem; color: var(--gray-400); flex-shrink: 0; }
.ap-chip-dur { font-size: .68rem; color: var(--gray-400); flex-shrink: 0; }
.ap-cell-total { font-size: .68rem; color: var(--gray-400); padding: .1rem .25rem; text-align: right; }

/* Unscheduled */
.ap-unscheduled { background: #fef9c3; border: 1px solid #fde047; border-radius: 6px; padding: .6rem .8rem; font-size: .85rem; }
.ap-unscheduled-list { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.ap-unsched-chip { background: #fff; border: 1px solid #fde047; border-radius: 12px; padding: .15rem .5rem; font-size: .78rem; cursor: pointer; }
.ap-unsched-chip:hover { border-color: var(--blue); }

/* Travel-arrow rows between chips */
.ap-cell-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .25rem; gap: .25rem; }
.ap-cell-from { font-size: .7rem; font-weight: 600; padding: .15rem .4rem; border-radius: 10px; white-space: nowrap; }
.ap-cell-from-home { background: #e0e7ff; color: #3730a3; }
.ap-cell-from-overnight { background: #f3e8ff; color: #6b21a8; }
.ap-travel-arrow { display: flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--gray-400); padding: .1rem .25rem; }
.ap-travel-min { font-weight: 600; color: var(--gray-600); }
.ap-travel-home { color: #6366f1; }
.ap-travel-overnight { color: #a855f7; }

/* Route preview button per day cell */
.ap-route-btn { background: transparent; border: 1.5px solid var(--gray-200); border-radius: 6px; padding: .15rem .35rem; font-size: .8rem; cursor: pointer; flex-shrink: 0; transition: background .15s, border-color .15s; line-height: 1; }
.ap-route-btn:hover { background: #eff6ff; border-color: var(--blue); }

/* Floating back-to-plan pill */
.ap-back-pill { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #1e293b; color: #f8fafc; padding: .55rem 1rem .55rem 1.1rem; border-radius: 24px; box-shadow: 0 4px 18px rgba(0,0,0,.35); font-size: .85rem; display: flex; align-items: center; gap: .5rem; z-index: 9999; white-space: nowrap; }
.ap-back-pill.hidden { display: none; }
.ap-back-btn { margin-left: .75rem; background: #3b82f6; color: white; border: none; border-radius: 14px; padding: .3rem .85rem; font-size: .8rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.ap-back-btn:hover { background: #2563eb; }
.ap-route-info { color: #94a3b8; font-size: .8rem; }

/* ════════════════════════════════════════════════════════
   TICKET-SYSTEM (Etappe A)
   ════════════════════════════════════════════════════════ */
.nav-badge { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: #ef4444; color: #fff; border-radius: 9px; padding: 1px 7px; font-size: .68rem; font-weight: 700; min-width: 18px; text-align: center; }
.nav-link { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; border-radius: 9px; padding: 0 5px; font-size: .65rem; font-weight: 700; min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Statistik-Header ── */
.ticket-stats-bar { display: flex; gap: .75rem; flex-wrap: wrap; padding: .85rem 1.25rem .5rem; }
.tk-stat { display: flex; flex-direction: column; align-items: center; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: .6rem 1.1rem; min-width: 80px; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .15s, box-shadow .15s; cursor: default; }
.tk-stat:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.08); }
.tk-stat-val { font-size: 1.5rem; font-weight: 800; line-height: 1; color: #0f172a; }
.tk-stat-lbl { font-size: .65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; white-space: nowrap; }
.tk-stat-open    { border-color: #bfdbfe; background: linear-gradient(135deg,#eff6ff,#fff); }
.tk-stat-open .tk-stat-val { color: #1d4ed8; }
.tk-stat-resolved{ border-color: #bbf7d0; background: linear-gradient(135deg,#f0fdf4,#fff); }
.tk-stat-resolved .tk-stat-val { color: #15803d; }
.tk-stat-closed  { border-color: #e2e8f0; background: #f9fafb; }
.tk-stat-closed .tk-stat-val  { color: #6b7280; }
.tk-stat-kritisch{ border-color: #fecaca; background: linear-gradient(135deg,#fff1f2,#fff); }
.tk-stat-kritisch .tk-stat-val{ color: #b91c1c; }
.tk-stat-overdue { border-color: #fed7aa; background: linear-gradient(135deg,#fff7ed,#fff); }
.tk-stat-overdue .tk-stat-val { color: #c2410c; }

/* ── Toolbar ── */
.tickets-toolbar { display: flex; gap: .45rem; flex-wrap: wrap; padding: .6rem 1.25rem .7rem; align-items: center; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.tickets-toolbar select, .tickets-toolbar input { width: auto; padding: .38rem .65rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: .82rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: border-color .15s, box-shadow .15s; }
.tickets-toolbar select:focus, .tickets-toolbar input:focus { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.tickets-search { flex: 1 1 200px; min-width: 180px; max-width: 340px; }
.view-header-meta { color: #64748b; font-size: .85rem; margin-left: .5rem; }

/* ── View-Toggle ── */
.tk-view-toggle { display: flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px; }
.tk-vtbtn { background: none; border: none; border-radius: 6px; padding: 5px 8px; cursor: pointer; color: #64748b; transition: background .12s, color .12s; display: flex; align-items: center; }
.tk-vtbtn:hover { background: #e2e8f0; color: #334155; }
.tk-vtbtn.active { background: #fff; color: #1d4ed8; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── Bulk-Bar ── */
.tickets-bulk-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem 1.25rem; background: linear-gradient(90deg,#eff6ff,#f0f9ff); border-bottom: 1px solid #bfdbfe; }
.tickets-bulk-bar.hidden { display: none; }
.bulk-count { font-size: .85rem; font-weight: 700; color: #1d4ed8; margin-right: .25rem; }
.bulk-sel { width: auto; padding: .3rem .55rem; border: 1px solid #93c5fd; border-radius: 7px; font-size: .82rem; background: #fff; cursor: pointer; }

/* ── Table ── */
.tickets-table-wrap { padding: 0 1.25rem 1.25rem; overflow-x: auto; }
.tickets-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04); font-size: .83rem; overflow: hidden; }
.tickets-table th, .tickets-table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tickets-table th { background: linear-gradient(180deg,#f8fafc,#f1f5f9); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.th-cb, .td-cb { width: 32px; padding: .3rem .4rem !important; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: #1e40af; background: #eff6ff; }
.th-sort::after { content: ''; display: inline-block; width: 7px; margin-left: 4px; opacity: .3; font-size: .65rem; }
.th-sort-asc::after  { content: '▲'; opacity: 1; color: #3b82f6; }
.th-sort-desc::after { content: '▼'; opacity: 1; color: #3b82f6; }
.tickets-table tr.tk-row { cursor: pointer; transition: background .12s; }
.tickets-table tr.tk-row:hover { background: #f8fbff; }
.tickets-table tr.tk-row:hover td:first-child { box-shadow: inset 3px 0 0 #3b82f6; }
.tk-row-selected { background: #eff6ff !important; }
.tk-row-selected td:first-child { box-shadow: inset 3px 0 0 #3b82f6 !important; }
.tickets-table tr.tk-prio-row-kritisch td:first-child { box-shadow: inset 4px 0 0 #ef4444; }
.tickets-table tr.tk-prio-row-hoch td:first-child     { box-shadow: inset 4px 0 0 #f97316; }
.tickets-table tr.tk-prio-row-normal td:first-child   { box-shadow: inset 4px 0 0 #eab308; }
.tickets-table tr.tk-prio-row-niedrig td:first-child  { box-shadow: inset 4px 0 0 #cbd5e1; }
.tickets-table tr.tk-row:last-child td { border-bottom: none; }

/* ── Card View ── */
.tickets-card-wrap { padding: .5rem 1.25rem 1.5rem; }
.tickets-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.tk-card { position: relative; background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.04); padding: 1rem; cursor: pointer; transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; gap: .55rem; overflow: hidden; }
.tk-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 12px 0 0 12px; }
.tk-card-prio-kritisch::before { background: #ef4444; }
.tk-card-prio-hoch::before     { background: #f97316; }
.tk-card-prio-normal::before   { background: #eab308; }
.tk-card-prio-niedrig::before  { background: #cbd5e1; }
.tk-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1), 0 1px 4px rgba(0,0,0,.06); }
.tk-card-selected { background: #eff6ff; border-color: #93c5fd; }
.tk-card-top { display: flex; align-items: center; gap: .45rem; }
.tk-card-id { font-size: .72rem; font-weight: 700; color: #94a3b8; letter-spacing: .04em; }
.tk-card-top .tk-status { margin-left: auto; }
.tk-card-cb-wrap { position: absolute; top: .65rem; right: .65rem; z-index: 1; opacity: 0; transition: opacity .12s; }
.tk-card:hover .tk-card-cb-wrap, .tk-card-selected .tk-card-cb-wrap { opacity: 1; }
.tk-card-cb-wrap input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: #3b82f6; }
.tk-card-title { font-size: .95rem; font-weight: 700; color: #0f172a; line-height: 1.3; padding-right: 1.5rem; }
.tk-card-addr { font-size: .76rem; color: #64748b; display: flex; align-items: center; gap: .25rem; }
.tk-card-pills { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.tk-card-footer { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: auto; padding-top: .35rem; border-top: 1px solid #f1f5f9; font-size: .74rem; color: #64748b; }
.tk-card-counts { margin-left: auto; display: flex; gap: .4rem; color: #94a3b8; }
.tk-overdue { color: #dc2626; font-weight: 700; font-size: .78rem; }
.tk-due     { color: #16a34a; font-size: .78rem; }
.tk-age     { color: #475569; font-size: .75rem; }
.tk-age-warn{ color: #d97706; font-size: .75rem; font-weight: 600; }
.tk-age-old { color: #dc2626; font-size: .75rem; font-weight: 700; }
.td-title-editable { outline: none; border-radius: 3px; padding: 1px 4px; min-width: 80px; display: inline-block; }
.td-title-editable:hover { background: rgba(0,0,0,.05); }
.td-title-editable:focus { background: #fffbeb; box-shadow: 0 0 0 2px #f59e0b; }
.td-desc-wrap { position: relative; }
.td-edit-desc-btn { position: absolute; top: .4rem; right: .4rem; font-size: .7rem; padding: 1px 6px; opacity: .6; }
.td-edit-desc-btn:hover { opacity: 1; }
#ticketsMyBtn.active { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; font-weight: 600; }
.tk-empty { color: #cbd5e1; }
.tk-tag { display: inline-block; color: #fff; padding: 1px 7px; border-radius: 10px; font-size: .7rem; font-weight: 600; margin-right: 3px; }
.tk-tech-pill { display: inline-block; color: #fff; padding: 1px 8px; border-radius: 10px; font-size: .72rem; font-weight: 600; }

.tk-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 600; color: #fff; }
.tk-status-open { background: #3b82f6; }
.tk-status-in_progress { background: #f59e0b; }
.tk-status-waiting { background: #a855f7; }
.tk-status-resolved { background: #22c55e; }
.tk-status-closed { background: #6b7280; }

.tk-prio { display: inline-block; font-weight: 600; font-size: .78rem; padding: 1px 6px; border-radius: 4px; }
.tk-prio-kritisch { color: #b91c1c; background: #fee2e2; }
.tk-prio-hoch { color: #c2410c; background: #ffedd5; }
.tk-prio-normal { color: #a16207; background: #fef3c7; }
.tk-prio-niedrig { color: #475569; background: #f1f5f9; }

/* Tag picker (in modals) */
.tag-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag-chip { background: #fff; border: 1.5px solid #d1d5db; border-radius: 14px; padding: 3px 10px; font-size: .78rem; font-weight: 600; cursor: pointer; transition: all .12s; }
.tag-chip:hover { transform: translateY(-1px); }
.tag-chip.sel { color: #fff; }

/* Address autocomplete */
.addr-results { background: #fff; border: 1px solid #d1d5db; border-radius: 6px; max-height: 220px; overflow-y: auto; margin-top: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.addr-result { padding: .45rem .65rem; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.addr-result:hover { background: #f0f9ff; }
.addr-result strong { display: block; }
.addr-result small { color: #64748b; font-size: .75rem; }
.addr-selected { padding: .4rem .65rem; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 6px; margin-top: .35rem; font-size: .85rem; display: flex; align-items: center; gap: .5rem; }

/* Ticket detail modal */
.td-grid { display: grid; grid-template-columns: 1fr 280px; gap: 1.25rem; }
.td-side { background: #f8fafc; padding: .85rem; border-radius: 8px; }
.td-side-row { margin-bottom: .65rem; }
.td-side-row label { display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; color: #64748b; margin-bottom: 3px; }
.td-side-row select { width: 100%; padding: .35rem; border: 1px solid #d1d5db; border-radius: 6px; }
.td-side-meta { font-size: .75rem; color: #64748b; border-top: 1px solid #e2e8f0; padding-top: .65rem; margin-top: .65rem; }
.td-side-meta div { margin-bottom: 3px; }
.td-meta-line { background: #eff6ff; padding: .45rem .65rem; border-radius: 6px; margin-bottom: .65rem; font-size: .85rem; }
.td-desc { background: #fff; border: 1px solid #e2e8f0; padding: .65rem; border-radius: 6px; min-height: 60px; margin-bottom: .85rem; white-space: pre-wrap; }
.td-main h4 { margin: 1rem 0 .4rem; font-size: .85rem; color: #475569; }
.td-empty { color: #94a3b8; font-style: italic; font-size: .85rem; }
.td-comments { display: flex; flex-direction: column; gap: .5rem; max-height: 320px; overflow-y: auto; }
.td-comment { background: #fff; border: 1px solid #e2e8f0; padding: .5rem .65rem; border-radius: 6px; }
.td-comment-head { font-size: .78rem; color: #64748b; margin-bottom: 3px; display: flex; gap: .5rem; align-items: baseline; }
.td-comment-admin { margin-left: auto; display: flex; gap: 3px; }
.td-comment-admin .btn-tiny { opacity: .45; font-size: .7rem; padding: 0 4px; line-height: 1.4; }
.td-comment-admin .btn-tiny:hover { opacity: 1; }
.td-comment-body { font-size: .9rem; color: #0f172a; }
.td-event { font-size: .78rem; color: #6b7280; padding: .3rem .65rem; border-left: 2px solid #cbd5e1; background: #f8fafc; border-radius: 0 4px 4px 0; }
.td-comment-form { display: flex; gap: .4rem; margin-top: .5rem; align-items: flex-end; }
.td-comment-form textarea { flex: 1; padding: .4rem; border: 1px solid #d1d5db; border-radius: 6px; resize: vertical; font-family: inherit; }
.btn-sm { padding: .3rem .8rem; font-size: .8rem; }

.td-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.td-image { position: relative; border-radius: 6px; overflow: hidden; background: #f1f5f9; aspect-ratio: 1; }
.td-image img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.td-image-cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px; font-size: .7rem; }
.td-image-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 1rem; line-height: 1; }
.td-image-upload { display: flex; gap: .4rem; margin-top: .4rem; }
.td-image-upload input[type=text] { flex: 1; padding: .35rem; border: 1px solid #d1d5db; border-radius: 6px; }

@media (max-width: 768px) {
  .td-grid { grid-template-columns: 1fr; }
}

/* Image lightbox */
.image-lightbox { background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 5000; }
.image-lightbox img { max-width: 95vw; max-height: 90vh; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: #fff; font-size: 2.5rem; cursor: pointer; line-height: 1; }
.lightbox-caption { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; max-width: 80vw; text-align: center; }

/* Notification dropdown */
.notif-dropdown { position: fixed; width: 340px; max-height: 480px; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 4000; display: flex; flex-direction: column; }
.notif-dropdown.hidden { display: none; }
.notif-dd-header { padding: .65rem .85rem; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.notif-dd-list { overflow-y: auto; flex: 1; }
.notif-empty { padding: 1.5rem; text-align: center; color: #94a3b8; font-size: .85rem; }
.notif-item { padding: .55rem .85rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background .1s; }
.notif-item:hover { background: #f0f9ff; }
.notif-item.unread { background: #eff6ff; border-left: 3px solid #3b82f6; }
.notif-title { font-weight: 600; font-size: .85rem; color: #0f172a; margin-bottom: 2px; }
.notif-body { font-size: .78rem; color: #475569; }
.notif-time { font-size: .7rem; color: #94a3b8; margin-top: 3px; }
.btn-tiny { padding: 2px 8px; font-size: .72rem; border-radius: 4px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; }
.btn-tiny:hover { background: #f1f5f9; }

/* Tag-Verwaltung in Settings */
.ticket-tags-list { display: flex; flex-direction: column; gap: .35rem; }
.tag-row { display: flex; align-items: center; gap: .55rem; padding: .35rem .55rem; background: #f8fafc; border-radius: 6px; font-size: .85rem; }
.tag-swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.tag-row strong { min-width: 100px; }
.tag-row .tag-desc { flex: 1; color: #64748b; font-size: .8rem; }
.tag-row .tag-sort { color: #94a3b8; font-size: .75rem; }

/* ════════════════════════════════════════════════════════
   ETAPPE B: Adress-Historie + Service-Protokoll
   ════════════════════════════════════════════════════════ */
.ah-meta { background: #f8fafc; padding: .65rem .85rem; border-radius: 6px; margin-bottom: .85rem; font-size: .85rem; }
.ah-addr-notes { color: #64748b; margin-top: .25rem; font-style: italic; }
.ah-tabs { display: flex; gap: .25rem; border-bottom: 2px solid #e2e8f0; margin-bottom: .75rem; flex-wrap: wrap; }
.ah-tab { background: none; border: none; padding: .5rem .85rem; cursor: pointer; font-size: .85rem; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.ah-tab.active { color: #0f172a; border-bottom-color: #3b82f6; font-weight: 600; }
.ah-tab:hover { color: #0f172a; }
.ah-pane { max-height: 480px; overflow-y: auto; padding-right: .25rem; }
.ah-pane.hidden { display: none; }
.ah-item { background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: .55rem .75rem; margin-bottom: .4rem; display: grid; grid-template-columns: 90px 1fr; gap: .5rem; align-items: start; cursor: pointer; transition: background .1s; }
.ah-item.ah-protocol { cursor: default; }
.ah-item:hover { background: #f0f9ff; }
.ah-when { font-size: .78rem; color: #64748b; font-weight: 600; }
.ah-main { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.ah-main .badge { background: #dbeafe; color: #1e40af; padding: 1px 7px; border-radius: 10px; font-size: .72rem; font-weight: 600; }
.ah-notes { grid-column: 2; font-size: .8rem; color: #475569; margin-top: 3px; }

/* Signature canvas */
.signature-wrap { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; padding: .5rem; margin-top: .35rem; }
#spmSigCanvas { width: 100%; height: 160px; background: #fff; border-radius: 4px; display: block; cursor: crosshair; touch-action: none; }
.signature-actions { margin-top: .35rem; display: flex; justify-content: flex-end; }
.btn-success { background: #16a34a; color: #fff; border: 1px solid #16a34a; padding: .5rem 1rem; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-success:hover { background: #15803d; }

/* Adress-Historie: Typ-Gruppen + Zusammenfassung */
.ah-summary { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .45rem; padding-top: .45rem; border-top: 1px dashed #cbd5e1; font-size: .8rem; }
.ah-sum strong { color: #0f172a; }
.ah-typesection { margin-bottom: .85rem; }
.ah-typesection h4 { font-size: .9rem; color: #0f172a; display: flex; align-items: center; gap: .35rem; }
.ah-count { background: #e2e8f0; color: #334155; padding: 1px 8px; border-radius: 10px; font-size: .72rem; font-weight: 600; margin-left: .25rem; }
.ah-hint { font-size: .75rem; color: #64748b; margin-bottom: .35rem; font-style: italic; }

/* Service-Protokoll: Kontextbox */
.spm-context { margin-bottom: .8rem; }
.spm-ctx-box { border-radius: 6px; padding: .65rem .85rem; font-size: .85rem; border-left: 4px solid #6b7280; background: #f8fafc; }
.spm-ctx-wartung { border-left-color: #3b82f6; background: #eff6ff; }
.spm-ctx-service { border-left-color: #f97316; background: #fff7ed; }
.spm-ctx-projekt { border-left-color: #a855f7; background: #faf5ff; }
.spm-ctx-title { font-weight: 600; margin-bottom: .35rem; }
.spm-ctx-list { margin: .2rem 0 0; padding-left: 1.2rem; }
.spm-ctx-list li { margin-bottom: .15rem; }
.spm-ctx-empty { color: #64748b; font-style: italic; }

/* ════════════════════════════════════════════════════════
   ETAPPE D: Mobile + Techniker-Dashboard
   ════════════════════════════════════════════════════════ */
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 90;
    background: #1e3a8a; color: #fff; padding: .55rem .85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    padding-top: calc(.55rem + env(safe-area-inset-top));
  }
  .mobile-menu-btn { background: none; border: none; color: #fff; padding: .35rem; cursor: pointer; display: flex; }
  #mobileBarTitle { font-weight: 600; font-size: 1rem; }
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 200; box-shadow: 4px 0 16px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 150; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .main-content { padding: .75rem; }
  .view-header { flex-direction: column; align-items: stretch; gap: .5rem; }
  .view-header-left, .view-header-right { width: 100%; }
  table { font-size: .85rem; }
  .modal { width: 95vw; max-width: 95vw; max-height: 92vh; }
  .form-row { grid-template-columns: 1fr; gap: .5rem; }
  .btn, .nav-link { min-height: 44px; }
  .modal-close, button.btn-icon { min-height: 40px; min-width: 40px; }
  .tickets-toolbar { flex-wrap: wrap; }
  .tickets-toolbar input, .tickets-toolbar select { min-width: 0; flex: 1 1 45%; }
}

/* Today / Dashboard */
.today-tabs { display: flex; gap: .35rem; margin-top: .35rem; }
.today-tab { background: #f1f5f9; border: 1px solid #cbd5e1; padding: .4rem .75rem; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: .85rem; }
.today-tab.active { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.today-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin: .85rem 0; }
.today-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: .65rem .9rem; flex: 1 1 130px; min-width: 130px; }
.today-stat .ts-num { font-size: 1.5rem; font-weight: 700; color: #0f172a; }
.today-stat .ts-lbl { font-size: .75rem; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.today-stat.ts-warn .ts-num { color: #f97316; }
.today-stat.ts-ok .ts-num { color: #16a34a; }

.today-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; min-height: 0; }
.today-list { display: grid; gap: .65rem; }
.today-card { background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #6b7280; border-radius: 8px; padding: .75rem .9rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.today-card.tc-done { opacity: .65; border-left-color: #16a34a; }
.today-card.tc-progress { border-left-color: #3b82f6; }
.today-card.tc-overdue { border-left-color: #dc2626; }
.tc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.tc-title { font-weight: 600; color: #0f172a; }
.tc-meta { font-size: .8rem; color: #64748b; margin-top: .15rem; }
.tc-addr { font-size: .85rem; color: #334155; margin-top: .25rem; }
.tc-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }
.tc-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .65rem; }
.tc-actions .btn { padding: .45rem .8rem; font-size: .82rem; }
.tc-time { font-size: .9rem; font-weight: 700; color: #1e3a8a; white-space: nowrap; }
.tc-status-pill { font-size: .7rem; padding: 2px 7px; border-radius: 10px; background: #e2e8f0; color: #334155; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tc-status-pill.tc-st-ang { background: #fef3c7; color: #92400e; }
.tc-status-pill.tc-st-uw { background: #dbeafe; color: #1e40af; }
.tc-status-pill.tc-st-vor { background: #ede9fe; color: #5b21b6; }
.tc-status-pill.tc-st-ok { background: #dcfce7; color: #166534; }
.today-empty { text-align: center; padding: 2rem; color: #64748b; }

/* Material list (settings + protocol) */
.mat-list { display: grid; gap: .35rem; }
.mat-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .4rem .6rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; }
.mat-sku { color: #64748b; font-size: .75rem; margin-left: .35rem; }
.mat-meta { font-size: .8rem; color: #475569; }
.mat-actions { display: flex; gap: .25rem; }

.spm-mat-list { display: grid; gap: .25rem; margin-top: .35rem; }
.spm-mat-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .3rem .55rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; font-size: .85rem; }
.spm-mat-qty { color: #1e3a8a; font-weight: 600; }

/* Stoppuhr */
.spm-timer { background: #0f172a; color: #fff; border-radius: 8px; padding: .65rem .85rem; margin-bottom: .85rem; }
.spm-timer-display { font-family: monospace; font-size: 1.1rem; font-weight: 700; text-align: center; padding: .35rem; }
.spm-timer-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
.spm-timer-actions .btn { background: #1e293b; color: #fff; border-color: #334155; padding: .4rem .7rem; font-size: .8rem; }
.spm-timer-actions .btn:hover { background: #334155; }
.spm-timer-actions .btn-danger { background: #dc2626; border-color: #dc2626; }

/* Notifications-Page */
.notif-filter-tabs { display:inline-flex; background:#f1f5f9; border-radius:6px; padding:.2rem; margin-right:.5rem; }
.notif-filter-tab { background:transparent; border:0; padding:.35rem .85rem; border-radius:4px; cursor:pointer; font-size:.85rem; color:#475569; }
.notif-filter-tab.active { background:#fff; color:#1e3a8a; font-weight:600; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.notif-page-list { display:grid; gap:.5rem; }
.notif-page-item { display:grid; grid-template-columns:auto 1fr auto; gap:.75rem; align-items:center; padding:.75rem 1rem; background:#fff; border:1px solid #e2e8f0; border-radius:8px; cursor:pointer; transition:all .15s; }
.notif-page-item:hover { border-color:#1e3a8a; box-shadow:0 2px 6px rgba(30,58,138,.08); }
.notif-page-item.unread { background:#eff6ff; border-color:#bfdbfe; }
.npi-icon { font-size:1.4rem; }
.npi-title { font-weight:600; color:#0f172a; margin-bottom:.15rem; }
.notif-page-item.unread .npi-title { color:#1e3a8a; }
.npi-text { color:#475569; font-size:.9rem; }
.npi-meta { display:flex; gap:.65rem; margin-top:.35rem; font-size:.75rem; color:#94a3b8; }
.npi-kind { background:#f1f5f9; padding:.1rem .45rem; border-radius:3px; }
.npi-actions { display:flex; gap:.3rem; flex-direction:column; }
.notif-empty { text-align:center; color:#94a3b8; padding:2rem; }

/* iOS Install Hint */
.ios-install-hint { position:fixed; bottom:1rem; left:50%; transform:translateX(-50%); max-width:90vw; z-index:9000; animation:slideUp .3s ease; }
@keyframes slideUp { from{transform:translate(-50%,100%);opacity:0} to{transform:translate(-50%,0);opacity:1} }
.iih-content { background:#1e3a8a; color:#fff; border-radius:12px; padding:.85rem 1rem; display:flex; align-items:center; gap:.7rem; box-shadow:0 8px 24px rgba(0,0,0,.25); font-size:.9rem; }
.iih-icon { font-size:1.6rem; }
.iih-text { flex:1; line-height:1.35; }
.iih-share { display:inline-block; background:rgba(255,255,255,.2); border-radius:4px; padding:.05rem .3rem; }
.iih-close { background:transparent; border:0; color:#fff; font-size:1.4rem; line-height:1; cursor:pointer; padding:.2rem .5rem; }
.iih-close:hover { background:rgba(255,255,255,.15); border-radius:4px; }

/* Kontakte */
.contact-card { display:flex; justify-content:space-between; align-items:flex-start; gap:.75rem; padding:.75rem .9rem; background:#fff; border:1px solid #e2e8f0; border-radius:8px; margin-bottom:.5rem; }
.contact-card.is-primary { border-color:#fbbf24; background:#fffbeb; }
.contact-main { flex:1; }
.contact-name { font-size:1rem; color:#0f172a; }
.contact-pos { color:#64748b; font-size:.85rem; margin-left:.5rem; font-weight:normal; }
.contact-info { display:flex; flex-wrap:wrap; gap:.85rem; margin-top:.35rem; font-size:.88rem; }
.contact-link { color:#1e3a8a; text-decoration:none; }
.contact-link:hover { text-decoration:underline; }
.contact-notes { color:#475569; font-size:.85rem; margin-top:.35rem; font-style:italic; }
.contact-actions { display:flex; gap:.25rem; flex-shrink:0; }

/* Comm-Log */
.commlog-item { padding:.65rem .85rem; background:#fff; border:1px solid #e2e8f0; border-left:3px solid #1e3a8a; border-radius:6px; margin-bottom:.5rem; }
.commlog-item.commlog-failed { border-left-color:#dc2626; background:#fef2f2; }
.commlog-head { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; font-size:.85rem; margin-bottom:.35rem; }
.commlog-kind { font-weight:600; color:#1e3a8a; }
.commlog-channel { color:#64748b; }
.commlog-when { color:#94a3b8; font-size:.8rem; margin-left:auto; }
.commlog-body { font-size:.88rem; color:#334155; }
.commlog-text { white-space:pre-wrap; margin-top:.3rem; padding:.4rem .6rem; background:#f8fafc; border-radius:4px; }
.commlog-meta { color:#94a3b8; font-size:.78rem; margin-top:.25rem; }
.commlog-error { color:#991b1b; font-size:.85rem; margin-top:.25rem; }

/* ───── Settings: Sidebar-Layout (Desktop) ───── */
.settings-layout { display:grid; grid-template-columns:240px 1fr; gap:1.5rem; align-items:start; }
.settings-sidebar { display:flex; flex-direction:column; gap:.25rem; position:sticky; top:1rem;
  background:#fff; border:1px solid #e5e7eb; border-radius:10px; padding:.6rem; }
.settings-sidebar .set-nav-btn { display:block; width:100%; text-align:left; padding:.6rem .8rem;
  border:none; background:transparent; border-radius:6px; color:#374151; font-size:.92rem; cursor:pointer; transition:background .15s; }
.settings-sidebar .set-nav-btn:hover { background:#f3f4f6; }
.settings-sidebar .set-nav-btn.active { background:#1e40af; color:#fff; font-weight:600; }
.settings-content { min-width:0; }
.settings-content .settings-grid { display:grid; gap:1.25rem; grid-template-columns:1fr; }
.settings-content .settings-card { display:none; }
.settings-content .settings-card.section-active { display:block; }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns:1fr; }
  .settings-sidebar { position:static; flex-direction:row; overflow-x:auto; padding:.4rem; }
  .settings-sidebar .set-nav-btn { white-space:nowrap; padding:.45rem .7rem; font-size:.85rem; }
}

/* ───── Foto-Annotations-Button auf Bildkacheln ───── */
.td-image { position:relative; }
.td-image-anno { position:absolute; bottom:4px; right:4px; background:rgba(0,0,0,0.6); color:#fff;
  border:none; border-radius:50%; width:26px; height:26px; cursor:pointer; font-size:.85rem; line-height:1;
  display:flex; align-items:center; justify-content:center; transition:background .15s; }
.td-image-anno:hover { background:#1e40af; }
.anno-tool.active { background:#1e40af; color:#fff; border-color:#1e40af; }

/* ───── System-Card Tabs ───── */
.sys-tab.active { background:#1e40af; color:#fff; border-color:#1e40af; }
.sys-status-tbl td, .sys-status-tbl th { border-bottom:1px solid #f1f5f9; font-size:.88rem; }

/* Modal-Shake bei Klick auf Backdrop (statt schließen) */
@keyframes modalShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.modal-shake { animation: modalShake .25s ease-in-out; }

/* Tour-Timeline: ID/Auftragsnr.-Badge mit Klick-zum-Kopieren */
.tl-ids { display:flex; gap:.25rem; justify-content:center; margin-top:.25rem; flex-wrap:wrap; }
.tl-id-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .68rem; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  background: #e0e7ff; color: #1e3a8a; border: 1px solid #c7d2fe;
  cursor: copy; user-select: all;
}
.tl-id-badge:hover { background:#c7d2fe; }
.tl-id-badge.tl-order-badge { background:#fef3c7; color:#78350f; border-color:#fde68a; }
.tl-id-badge.tl-order-badge:hover { background:#fde68a; }
.tl-id-badge.copied { background:#16a34a !important; color:#fff !important; border-color:#15803d !important; }

/* ───── OBJEKTE / ANLAGEN ───── */
.obj-layout { display:grid; grid-template-columns: 360px 1fr; gap:1rem; height:calc(100vh - 140px); min-height:500px; }
.obj-list-pane { background:#fff; border:1px solid #e2e8f0; border-radius:8px; overflow:auto; }
.obj-detail-pane { background:#fff; border:1px solid #e2e8f0; border-radius:8px; overflow:auto; }
.obj-list { display:flex; flex-direction:column; }
.obj-item { padding:.75rem 1rem; border-bottom:1px solid #f1f5f9; cursor:pointer; transition:background .15s; }
.obj-item:hover { background:#f8fafc; }
.obj-item.selected { background:#dbeafe; border-left:3px solid #2563eb; }
.obj-item-name { font-weight:700; color:#0f172a; }
.obj-item-addr { font-size:.78rem; color:#64748b; margin-top:.15rem; }
.obj-item-chips { display:flex; flex-wrap:wrap; gap:.25rem; margin-top:.4rem; }
.obj-chip { font-size:.7rem; padding:1px 6px; border-radius:10px; font-weight:600; }
.obj-detail { padding:1rem 1.25rem; }
.obj-detail-empty { padding:3rem; text-align:center; color:#94a3b8; }
.obj-detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; padding-bottom:.75rem; border-bottom:2px solid #e2e8f0; margin-bottom:1rem; }
.obj-addr-line { color:#475569; margin-top:.25rem; }
.obj-notes { background:#fef3c7; padding:.4rem .6rem; border-radius:4px; margin-top:.4rem; font-size:.85rem; color:#78350f; }
.obj-tabs { display:flex; gap:.4rem; border-bottom:1px solid #e2e8f0; margin-bottom:1rem; flex-wrap:wrap; }
.obj-tab { padding:.5rem 1rem; background:transparent; border:none; border-bottom:3px solid transparent; cursor:pointer; font-weight:600; color:#64748b; }
.obj-tab.active { color:#2563eb; border-bottom-color:#2563eb; }
.obj-pane.hidden { display:none; }
.obj-group { margin-bottom:1.25rem; }
.obj-group-head { font-weight:700; color:#0f172a; margin-bottom:.4rem; }
.obj-group-count { background:#e2e8f0; color:#475569; padding:1px 8px; border-radius:10px; font-size:.75rem; margin-left:.4rem; }
.obj-tbl { width:100%; border-collapse:collapse; font-size:.85rem; }
.obj-tbl th { text-align:left; padding:.4rem .5rem; background:#f8fafc; border-bottom:1px solid #e2e8f0; color:#475569; font-size:.75rem; text-transform:uppercase; }
.obj-tbl td { padding:.5rem; border-bottom:1px solid #f1f5f9; vertical-align:top; }
.obj-tbl tr:hover { background:#f8fafc; }
.obj-wf-pill { display:inline-block; padding:2px 8px; border-radius:10px; color:#fff; font-size:.72rem; font-weight:600; }
.obj-tech-pill { display:inline-block; padding:2px 8px; border-radius:10px; color:#fff; font-size:.72rem; font-weight:600; }
.obj-empty { padding:1.5rem; color:#94a3b8; text-align:center; }
.obj-img-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:.5rem; }
.obj-img-cell { background:#0f172a; border-radius:6px; overflow:hidden; cursor:pointer; position:relative; }
.obj-img-cell img { width:100%; height:140px; object-fit:cover; display:block; }
.obj-img-cap { position:absolute; bottom:0; left:0; right:0; background:linear-gradient(transparent,rgba(0,0,0,.75)); color:#fff; padding:.5rem .4rem .35rem; font-size:.7rem; }
@media (max-width: 900px) {
  .obj-layout { grid-template-columns:1fr; height:auto; }
  .obj-list-pane { max-height:300px; }
}

/* ───── Aufgaben / Tasks ───── */
.task-tabs .task-tab {
  background: transparent; border: 1px solid var(--gray-300); border-radius: 6px;
  padding: .35rem .8rem; cursor: pointer; font-size: .9rem; color: var(--gray-700);
}
.task-tabs .task-tab.active { background: var(--primary, #1e3a8a); color: #fff; border-color: var(--primary, #1e3a8a); }
.task-tabs .task-tab:hover:not(.active) { background: #f1f5f9; }
.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-card {
  display: grid;
  /* 4 Spalten: Bulk-CB · Status-CB · Inhalt(1fr) · Aktionen
     Gilt auch wenn .task-bulk-cb (noch) nicht gesetzt ist (leere auto-Spalte = 0px). */
  grid-template-columns: auto auto minmax(0,1fr) auto;
  gap: .6rem;
  align-items: start;
  padding: .65rem .8rem;
  border: 1px solid var(--gray-200);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fff;
}
.task-card > .task-bulk-cb { align-self: center; margin: 0; }
.task-card > .task-checkbox { align-self: center; }
.task-card > .task-main { min-width: 0; }
.task-card > .task-actions { align-self: center; }
.task-card.prio-high   { border-left-color: #dc2626; }
.task-card.prio-normal { border-left-color: #3b82f6; }
.task-card.prio-low    { border-left-color: #94a3b8; }
.task-card.status-done       { opacity: .6; background: #f8fafc; }
.task-card.status-cancelled  { opacity: .55; background: #fef2f2; }
.task-card.overdue { box-shadow: 0 0 0 2px #fee2e2; }
.task-checkbox {
  width: 22px; height: 22px; cursor: pointer; margin-top: .15rem;
}
.task-main { min-width: 0; }
.task-title { font-weight: 600; color: var(--gray-900); }
.task-card.status-done .task-title { text-decoration: line-through; }
.task-meta { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .8rem; color: #64748b; margin-top: .2rem; }
.task-meta .pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .1rem .45rem; border-radius: 10px; background: #f1f5f9; color: #334155;
}
.task-meta .pill.tech { color: #fff; }
.task-meta .pill.due-overdue { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.task-meta .pill.due-today   { background: #fef3c7; color: #92400e; font-weight: 600; }
.task-meta .pill.source { background: #ede9fe; color: #6d28d9; }
.task-desc { font-size: .85rem; color: #475569; margin-top: .25rem; white-space: pre-wrap; }
.task-actions { display: flex; gap: .25rem; flex-wrap: nowrap; }
.task-section-head {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: #64748b; margin: .8rem 0 .3rem;
}
.task-empty { color: #94a3b8; padding: 1.5rem; text-align: center; }
.task-appt-dropdown {
  position: absolute; z-index: 200; background: #fff; border: 1px solid var(--gray-300);
  border-radius: 6px; max-height: 220px; overflow-y: auto; min-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.task-appt-dropdown .item {
  padding: .5rem .7rem; cursor: pointer; font-size: .85rem; border-bottom: 1px solid #f1f5f9;
}
.task-appt-dropdown .item:hover { background: #eff6ff; }
.task-appt-dropdown .item:last-child { border-bottom: 0; }

/* ─────────── Task Extensions ─────────── */
.task-modal-tabs { display:flex; gap:.3rem; padding:0 1rem; border-bottom:1px solid #e5e7eb; background:#f8fafc; }
.task-mtab { background:none; border:none; padding:.6rem .9rem; cursor:pointer; color:#64748b; font-weight:500; border-bottom:2px solid transparent; }
.task-mtab.active { color:#1e40af; border-bottom-color:#1e40af; }
.task-mtab-badge { background:#e0e7ff; color:#1e40af; padding:0 .4rem; border-radius:10px; font-size:.75rem; margin-left:.25rem; }

.task-cl-item { display:flex; align-items:center; gap:.5rem; padding:.4rem .5rem; border-bottom:1px solid #f1f5f9; }
.task-cl-item.done { color:#94a3b8; text-decoration:line-through; background:#f8fafc; }
.task-cl-item input[type="checkbox"] { width:18px; height:18px; flex-shrink:0; }
.task-cl-item span { flex:1; }

.task-comment { padding:.5rem; border-bottom:1px solid #f1f5f9; }
.task-comment:last-child { border:none; }
.task-comment-meta { font-size:.78rem; color:#94a3b8; display:flex; align-items:center; gap:.4rem; }
.task-comment-body { margin-top:.2rem; font-size:.9rem; }

.task-bulk-bar { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; padding:.5rem .8rem; background:#1e40af; color:white; }
.task-bulk-bar button { color:white; border-color:#3b82f6; background:rgba(255,255,255,.1); }
.task-bulk-bar button:hover { background:rgba(255,255,255,.2); }
.task-bulk-cb { width:18px; height:18px; margin-right:.4rem; vertical-align:middle; cursor:pointer; }
.task-card.bulk-selected { background:#dbeafe; border-color:#1e40af; }

#taskKanbanToggleBtn.active { background:#1e40af; color:white; }
.task-kanban { display:flex; gap:.6rem; overflow-x:auto; padding:.5rem; min-height:400px; }
.kanban-col { flex:0 0 280px; background:#f1f5f9; border-radius:8px; display:flex; flex-direction:column; max-height:75vh; }
.kanban-col-head { padding:.6rem .8rem; font-weight:600; border-top:4px solid; border-radius:8px 8px 0 0; background:white; display:flex; justify-content:space-between; align-items:center; }
.kanban-col-head span { background:#e2e8f0; padding:.1rem .5rem; border-radius:10px; font-size:.78rem; color:#64748b; }
.kanban-col-body { padding:.5rem; flex:1; overflow-y:auto; min-height:80px; transition:background .15s; }
.kanban-col-body.drag-over { background:#dbeafe; }
.kanban-card { background:white; border-radius:6px; padding:.5rem .6rem; margin-bottom:.5rem; box-shadow:0 1px 2px rgba(0,0,0,.08); cursor:grab; border-left:3px solid #94a3b8; }
.kanban-card.prio-high { border-left-color:#dc2626; }
.kanban-card.prio-low  { border-left-color:#10b981; }
.kanban-card.dragging { opacity:.5; }
.kanban-card-title { font-weight:500; margin-bottom:.3rem; font-size:.92rem; }
.kanban-card-meta { display:flex; flex-wrap:wrap; gap:.25rem; }
.kanban-card-meta .pill { font-size:.72rem; }

.today-tasks-tile { background:linear-gradient(135deg,#dbeafe,#fef3c7); border-radius:8px; padding:.8rem 1rem; margin-bottom:.8rem; }
.ttile-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:.5rem; }
.ttile-head a { text-decoration:none; font-size:.85rem; }
.ttile-stats { display:flex; gap:.6rem; }
.ttile-stat { background:white; padding:.5rem .8rem; border-radius:6px; flex:1; text-align:center; box-shadow:0 1px 2px rgba(0,0,0,.06); }
.ttile-stat .n { font-size:1.6rem; font-weight:700; color:#1e40af; }
.ttile-stat .l { font-size:.75rem; color:#64748b; }
.ttile-stat.today .n   { color:#f59e0b; }
.ttile-stat.overdue .n { color:#dc2626; }
.ttile-task { display:flex; align-items:center; gap:.5rem; padding:.3rem .5rem; border-bottom:1px solid #f1f5f9; }
.ttile-task.overdue .ttitle { color:#dc2626; }
.ttile-task .ttitle { flex:1; font-size:.88rem; }
.ttile-due { font-size:.75rem; color:#64748b; }

.obj-task-row { display:flex; align-items:center; gap:.5rem; padding:.4rem .6rem; border-bottom:1px solid #f1f5f9; cursor:pointer; }
.obj-task-row:hover { background:#f8fafc; }
.obj-task-row.overdue strong { color:#dc2626; }
.obj-task-row.status-done { opacity:.5; text-decoration:line-through; }
.task-pill { display:inline-block; background:#dbeafe; color:#1e40af; padding:.1rem .4rem; border-radius:10px; font-size:.7rem; margin-right:.3rem; }
.task-pill.overdue { background:#fee2e2; color:#dc2626; }

.task-stats-totals { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:.5rem; }
.stat-tile { background:#f1f5f9; padding:.6rem; border-radius:6px; text-align:center; }
.stat-tile.overdue { background:#fef2f2; }
.stat-tile.done    { background:#f0fdf4; }
.stat-tile .n { font-size:1.4rem; font-weight:700; color:#1e40af; }
.stat-tile .l { font-size:.78rem; color:#64748b; }
.task-stats-chart { padding:.4rem 0; }
.bar-chart { display:flex; gap:2px; align-items:flex-end; height:140px; overflow-x:auto; padding:.2rem 0; }
.bar-col { display:flex; flex-direction:column; align-items:center; min-width:24px; }
.bar-stack { display:flex; gap:1px; height:120px; align-items:flex-end; width:100%; }
.bar { width:50%; min-height:1px; }
.bar.c { background:#3b82f6; }
.bar.d { background:#10b981; }
.bar-x { font-size:.6rem; color:#94a3b8; transform:rotate(-45deg); margin-top:.3rem; }
.src-grid { display:flex; flex-wrap:wrap; gap:.4rem; }
.src-pill { background:#f1f5f9; padding:.3rem .6rem; border-radius:6px; font-size:.85rem; }
.src-pill strong { color:#1e40af; }

@media (max-width:640px) {
  .task-bulk-bar { font-size:.85rem; padding:.4rem .5rem; }
  .task-bulk-bar button { padding:.3rem .5rem; font-size:.8rem; }
  .task-tabs { overflow-x:auto; flex-wrap:nowrap !important; }
  .task-tab { white-space:nowrap; flex-shrink:0; }
  .kanban-col { flex:0 0 230px; }
  .task-card { font-size:.92rem; }
  .ttile-stats { gap:.3rem; }
  .ttile-stat .n { font-size:1.3rem; }
}

/* ─────────── Toolbar / View-Header (Tasks, Tickets …) ─────────── */
.view-header-right { flex-wrap: wrap; row-gap: .4rem; }
.view-header-right input,
.view-header-right select,
.view-header-right textarea { width: auto; padding: .4rem .65rem; font-size: .85rem; height: 34px; }
.view-header-right input[type="search"] { min-width: 180px; max-width: 240px; }
.view-header-right select { min-width: 130px; max-width: 200px; }
.view-header-right .btn { padding: .4rem .7rem; font-size: .85rem; height: 34px; display: inline-flex; align-items: center; gap: .25rem; }
.view-header-right .btn-primary { box-shadow: 0 1px 2px rgba(30,64,175,.25); }
.view-header-right > * { margin: 0; }

/* Trennlinie zwischen Filter-Block und Aktionen */
.view-header-right .toolbar-sep { width: 1px; height: 22px; background: var(--gray-200); margin: 0 .25rem; }

/* Sticky-Tabs (Filter Meine/Offen/…) */
#view-tasks .task-tabs { position: sticky; top: 0; background: white; z-index: 5; flex-wrap: wrap; }
#view-tasks .task-tab { background: #f1f5f9; border: 1px solid transparent; padding: .35rem .75rem; border-radius: 6px; font-size: .85rem; cursor: pointer; color: #475569; transition: all .12s; }
#view-tasks .task-tab:hover { background: #e2e8f0; }
#view-tasks .task-tab.active { background: #1e40af; color: white; border-color: #1e40af; }

/* Bulk-Bar etwas hübscher */
.task-bulk-bar { border-bottom: 1px solid #1e3a8a; gap: .5rem !important; padding: .55rem 1rem !important; align-items: center; box-shadow: inset 0 -2px 0 rgba(0,0,0,.1); }
.task-bulk-bar > span:first-child { background: rgba(255,255,255,.18); padding: .2rem .55rem; border-radius: 12px; font-size: .85rem; }

@media (max-width: 900px) {
  .view-header-right input[type="search"] { min-width: 140px; flex: 1; }
  .view-header-right select { min-width: 120px; flex: 1; }
}

/* Klickbarer Tour-Footer in Kalenderzellen */
.cal-cell { padding-bottom: 22px; }            /* Platz für den Footer */
.cal-day-tour {
  position: absolute; left: 2px; right: 2px; bottom: 2px;
  height: 18px; padding: 0 .35rem;
  background: rgba(59,130,246,.08); color: #1e40af;
  border: 1px dashed rgba(59,130,246,.35); border-radius: 4px;
  font-size: .68rem; font-weight: 600; line-height: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s, border-color .12s;
}
.cal-day-tour:hover { background: rgba(59,130,246,.18); border-color: var(--blue); border-style: solid; }
.cal-day-tour span { flex:1; text-align: right; }
/* Bei wenig Inhalt: ganze leere Zelle bleibt klickbar — Footer reicht trotzdem */
.cal-cell.weekend .cal-day-tour { background: rgba(59,130,246,.05); }

/* Klickbarer Tour-Footer in Mini-Kalender (unter der Karte) */
.mini-cal-cell { padding-bottom: 18px; position: relative; }
.mini-cal-tour {
  position: absolute; left: 2px; right: 2px; bottom: 1px;
  height: 15px; padding: 0 .35rem;
  background: rgba(59,130,246,.10); color: #1e40af;
  border: 1px dashed rgba(59,130,246,.4); border-radius: 3px;
  font-size: .62rem; font-weight: 700; line-height: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: .2rem; white-space: nowrap; overflow: hidden;
  transition: background .12s, border-color .12s;
}
.mini-cal-tour:hover { background: rgba(59,130,246,.22); border-style: solid; border-color: var(--blue); }
.mini-cal-tour span { color: #1e40af; }

.mini-cal-week-copy {
  position: absolute; top: 1px; right: 1px;
  height: 14px; padding: 0 4px;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; border-radius: 3px;
  font-size: .58rem; font-weight: 700; line-height: 12px;
  cursor: pointer; white-space: nowrap; z-index: 2;
  transition: background .12s, border-color .12s;
}
.mini-cal-week-copy:hover { background: #fde68a; border-color: #f59e0b; }

/* ============================================================
   Auftragsübersicht – Desktop-Layout (verteilte Spalten)
   ============================================================ */
#view-appointments .table-wrap { padding: .75rem 1rem 1rem; }
#apptTable { table-layout: fixed; }
#apptTable th, #apptTable td {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
/* Notizen dürfen umbrechen */
#apptTable td:nth-child(7) { white-space: normal; }

/* Spaltenbreiten – sinnvoll verteilt auf Desktop */
#apptTable th:nth-child(1), #apptTable td:nth-child(1) { width: 36px; text-align: center; padding-left: .5rem; padding-right: .5rem; }
#apptTable th:nth-child(2), #apptTable td:nth-child(2) { width: 130px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gray-900); }
#apptTable th:nth-child(3), #apptTable td:nth-child(3) { width: 22%; min-width: 160px; }
#apptTable th:nth-child(4), #apptTable td:nth-child(4) { width: auto; min-width: 220px; color: var(--gray-700); }
#apptTable th:nth-child(5), #apptTable td:nth-child(5) { width: 110px; }
#apptTable th:nth-child(6), #apptTable td:nth-child(6) { width: 130px; }
#apptTable th:nth-child(7), #apptTable td:nth-child(7) { width: 22%; min-width: 180px; }
#apptTable th:nth-child(8), #apptTable td:nth-child(8) { width: 56px; text-align: center; padding-left: .25rem; padding-right: .5rem; }

/* Hover etwas stärker, Zeile fühlbar klickbar */
#apptTable tbody tr { transition: background .08s; }
#apptTable tbody tr:hover td { background: var(--blue-light); }
#apptTable tbody tr:nth-child(even) td { background: rgba(248,250,252,.55); }
#apptTable tbody tr:nth-child(even):hover td { background: var(--blue-light); }

/* Status- und Typ-Badges schön zentriert */
#apptTable td .badge { display: inline-block; min-width: 70px; text-align: center; }

/* Notizen-Stil */
#apptTable td:nth-child(7) span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }

/* Action-Button gut sichtbar */
#apptTable td .btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--gray-200);
  background: #fff; color: var(--gray-600); transition: all .12s;
}
#apptTable td .btn-icon:hover { background: var(--green, #16a34a); color: #fff; border-color: transparent; }
#apptTable td .btn-icon svg { width: 16px; height: 16px; }

/* Bei sehr breiten Bildschirmen Adresse/Notizen mehr Raum geben */
@media (min-width: 1400px) {
  #apptTable th:nth-child(3), #apptTable td:nth-child(3) { width: 18%; }
  #apptTable th:nth-child(4), #apptTable td:nth-child(4) { min-width: 280px; }
  #apptTable th:nth-child(7), #apptTable td:nth-child(7) { width: 26%; }
}

/* Mobile: Tabelle wird zur Karten-Liste, damit nichts rechts abgeschnitten wirkt */
@media (max-width: 768px) {
  #apptTable, #apptTable thead, #apptTable tbody, #apptTable tr, #apptTable td, #apptTable th { display: block; width: 100% !important; }
  #apptTable thead { display: none; }
  #apptTable tbody tr {
    background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
    margin-bottom: .65rem; padding: .65rem .8rem; box-shadow: 0 1px 2px rgba(0,0,0,.04);
    display: grid; grid-template-columns: auto 1fr auto; gap: .35rem .65rem; align-items: center;
  }
  #apptTable tbody tr:hover td, #apptTable tbody tr:nth-child(even) td { background: transparent; }
  #apptTable td { border: 0 !important; padding: 0 !important; white-space: normal !important; overflow: visible !important; min-width: 0 !important; }
  #apptTable td:nth-child(1) { grid-row: 1; grid-column: 1; }
  #apptTable td:nth-child(2) { grid-row: 1; grid-column: 2; font-weight: 700; color: var(--gray-900); }
  #apptTable td:nth-child(8) { grid-row: 1; grid-column: 3; text-align: right; }
  #apptTable td:nth-child(3) { grid-column: 1 / -1; font-weight: 600; color: var(--gray-900); }
  #apptTable td:nth-child(4) { grid-column: 1 / -1; color: var(--gray-600); font-size: .8rem; }
  #apptTable td:nth-child(5) { grid-row: 5; grid-column: 1; }
  #apptTable td:nth-child(6) { grid-row: 5; grid-column: 2 / -1; }
  #apptTable td:nth-child(7) { grid-column: 1 / -1; font-size: .75rem; color: var(--gray-500); border-top: 1px dashed var(--gray-100) !important; padding-top: .35rem !important; margin-top: .15rem; }
  #apptTable td:nth-child(7):empty { display: none; }
}

/* ============================================================
   Mobile-Fixes (≤900px)
   – globales Scrollen wieder aktivieren (Body scrollt)
   – Karte: Vollbild + schlanke Such-Toolbar oben + Auftragsliste unten
   – Benachrichtigungs-Buttons: dunkler, lesbarer Text auf hellem Grund
   ============================================================ */
@media (max-width: 900px) {
  /* Höhen-Constraints aufheben, damit der Body scrollen kann */
  html, body { height: auto; min-height: 100%; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .main-content { overflow: visible; flex: 1 1 auto; padding: .5rem; }
  .view { height: auto; min-height: calc(100vh - 60px); overflow: visible; }
  .view.active { display: flex; }

  /* Tabellen-/Listenbereiche dürfen wieder „im Body" scrollen */
  .table-wrap, .calendar-wrap, .tech-grid, .notif-page-list, .task-list { overflow: visible; }

  /* ── Karte: Vollbild-Karte + schlanke Such-Toolbar ── */
  #view-map { height: calc(100vh - 56px); min-height: 0; overflow: hidden; padding: 0; position: relative; }
  #view-map.active { display: flex; flex-direction: column; }
  #view-map .view-header { display: none; } /* Desktop-Header weg */
  #view-map .map-mobile-bar {
    display: flex; gap: .35rem; align-items: center;
    position: absolute; top: 8px; left: 8px; right: 8px; z-index: 1100;
    background: white; border-radius: 8px; padding: .35rem .45rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }
  #view-map .map-mobile-bar input[type="search"] {
    flex: 1; min-width: 0; height: 36px; padding: .35rem .55rem;
    border: 1px solid var(--gray-200); border-radius: 6px; font-size: .9rem;
  }
  #view-map .map-mobile-bar button { height: 36px; padding: 0 .6rem; }
  #view-map .map-main-area { height: 100%; overflow: hidden; }
  #view-map .map-container-wrap { flex: 1 1 auto; min-height: 60vh; }
  /* Plan-Panel komplett ausblenden – Planen geht nur am Desktop */
  #view-map .map-plan-panel,
  #view-map #mapMiniCal { display: none !important; }

  /* Untere Auftragsliste (max ¼) */
  #view-map .map-mobile-list {
    flex: 0 0 28vh; max-height: 28vh; overflow-y: auto;
    background: white; border-top: 1px solid var(--gray-200);
    -webkit-overflow-scrolling: touch;
  }
  #view-map .map-mobile-list .mml-empty { padding: .8rem; text-align: center; color: var(--gray-500); font-size: .85rem; }
  #view-map .map-mobile-list .mml-item {
    display: grid; grid-template-columns: 1fr auto; gap: .25rem .5rem;
    padding: .55rem .75rem; border-bottom: 1px solid var(--gray-100); cursor: pointer;
  }
  #view-map .map-mobile-list .mml-item:active { background: var(--blue-light); }
  #view-map .map-mobile-list .mml-name { font-weight: 600; color: var(--gray-900); font-size: .88rem; }
  #view-map .map-mobile-list .mml-meta { grid-column: 1 / -1; color: var(--gray-500); font-size: .75rem; }
  #view-map .map-mobile-list .mml-num  { font-variant-numeric: tabular-nums; color: var(--gray-600); font-size: .78rem; }

  /* Side-Panel als Vollbild-Sheet */
  #apptSidePanel { position: fixed; inset: 0; max-width: none; width: 100% !important; z-index: 1200; }
}
@media (min-width: 901px) {
  #view-map .map-mobile-bar, #view-map .map-mobile-list { display: none !important; }
}

/* Benachrichtigungs-Buttons: explizit dunkle Schrift auf weißem Grund */
.notif-page-item .npi-actions .btn-tiny { color: #1e3a8a; background: #fff; border: 1px solid #cbd5e1; font-weight: 600; }
.notif-page-item .npi-actions .btn-tiny:hover { background: #eff6ff; border-color: #1e40af; }
.notif-page-item .npi-actions .btn-tiny.btn-primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.notif-page-item .npi-actions .btn-tiny.btn-primary:hover { background: var(--blue-dark); }

/* ============================================================
   Globaler Stoppuhr-Indikator (Pille unten rechts) + Meine Zeiten
   ============================================================ */
.running-timer-pill {
  position: fixed; right: 14px; bottom: 14px; z-index: 4500;
  display: inline-flex; align-items: center; gap: .5rem;
  background: #dc2626; color: #fff; padding: .45rem .55rem .45rem .7rem;
  border-radius: 999px; box-shadow: 0 6px 18px rgba(220,38,38,.35);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums;
  animation: rtpFade .25s ease;
}
.running-timer-pill.hidden { display: none; }
.running-timer-pill .rtp-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: rtpPulse 1.4s infinite;
}
.running-timer-pill .rtp-clock { background: rgba(0,0,0,.18); padding: .15rem .55rem; border-radius: 999px; font-weight: 700; }
.running-timer-pill .rtp-stop {
  background: rgba(255,255,255,.18); border: 0; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; font-size: .9rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.running-timer-pill .rtp-stop:hover { background: rgba(255,255,255,.32); }
@keyframes rtpPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
  70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
@keyframes rtpFade { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* "Meine Zeiten" View */
.my-time-summary { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem 1rem 0; }
.mt-stat { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: .6rem .85rem; flex: 1 1 140px; min-width: 140px; }
.mt-stat .mt-num { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.mt-stat .mt-lbl { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; margin-top: .15rem; }
.my-time-list { padding: .75rem 1rem 1.25rem; display: flex; flex-direction: column; gap: .9rem; overflow-y: auto; }
.mt-day { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; }
.mt-day-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem .85rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: .9rem; }
.mt-day-sum { color: var(--gray-600); font-variant-numeric: tabular-nums; font-weight: 600; }
.mt-row { display: grid; grid-template-columns: 110px 1fr 200px 90px; gap: .5rem; align-items: center; padding: .5rem .85rem; border-bottom: 1px solid var(--gray-100); font-size: .88rem; }
.mt-row:last-child { border-bottom: 0; }
.mt-row.running { background: #fef9c3; }
.mt-row .mt-kind { font-weight: 600; color: var(--gray-700); }
.mt-row .mt-appt { color: var(--blue-dark); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.mt-row .mt-appt:hover { text-decoration: underline; }
.mt-row .mt-appt-none { color: var(--gray-400); }
.mt-row .mt-time { color: var(--gray-600); font-variant-numeric: tabular-nums; font-size: .82rem; text-align: right; }
.mt-row .mt-dur { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; color: var(--gray-900); }
@media (max-width: 768px) {
  .mt-row { grid-template-columns: 1fr auto; gap: .15rem .5rem; padding: .5rem .65rem; }
  .mt-row .mt-kind { grid-row: 1; grid-column: 1; }
  .mt-row .mt-dur  { grid-row: 1; grid-column: 2; }
  .mt-row .mt-appt-cell { grid-column: 1 / -1; font-size: .82rem; }
  .mt-row .mt-time { grid-column: 1 / -1; text-align: left; font-size: .75rem; }
}

/* QW#19 Tagesfortschritts-Leiste */
.today-progress-wrap { flex: 1 1 100%; padding: 0 .25rem .5rem; }
.today-progress-row { display: flex; align-items: center; gap: .75rem; }
.today-progress-bar { flex: 1; height: 10px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.today-progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .35s ease; border-radius: 999px; }
.today-progress-text { font-size: .82rem; color: var(--gray-700); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .today-progress-text { font-size: .75rem; } }

/* Wartung-Strukturfragen im Protokoll-Modal */
.spm-w-checks { display:flex; gap:1.5rem; padding:.5rem .75rem; background:#fef3c7; border:1px solid #fbbf24; border-radius:6px; margin-bottom:.75rem; font-weight:600; }
.spm-w-checks label { display:flex; align-items:center; gap:.35rem; cursor:pointer; }
.spm-w-section { border:1px solid var(--gray-200); border-radius:8px; padding:.65rem .85rem; margin-bottom:.75rem; background:#fafafa; }
.spm-w-section h4 { margin:0 0 .5rem; font-size:.92rem; color:#1e3a8a; padding-bottom:.25rem; border-bottom:2px solid #e8723a; }
.spm-w-section .form-group { margin-bottom:.5rem; }
.spm-w-section label { font-size:.82rem; color:var(--gray-700); display:inline-flex; align-items:center; gap:.3rem; }
.spm-w-section input[type="text"], .spm-w-section input[type="date"], .spm-w-section input[type="time"] { width:100%; padding:.35rem .5rem; border:1px solid var(--gray-300); border-radius:5px; font-size:.85rem; }
.spm-w-section input[readonly] { background:var(--gray-100); color:var(--gray-600); }

/* Inspektionsauftragstyp-Tag im Side-Panel-Header (neben Auftragsnr.) */
.sp-inspection-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 2px 8px; border-radius: 10px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  color: #fff; background: #6b7280;
  white-space: nowrap; line-height: 1.3;
  margin-left: .35rem; vertical-align: middle;
}
.sp-inspection-sel {
  display: inline-block;
  padding: 2px 18px 2px 7px;
  border-radius: 10px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  color: #374151; background: #f3f4f6;
  border: 1px solid #d1d5db;
  cursor: pointer; outline: none;
  white-space: nowrap; line-height: 1.4;
  max-width: 170px;
  appearance: auto;
  transition: background .15s, color .15s;
}
.sp-inspection-sel[data-itype]:not([data-itype=""]) {
  border-color: transparent;
}
.sp-inspection-tag[data-itype="Wartung"]                { background: #6b7280; }
.sp-inspection-tag[data-itype="Wartung Video"]          { background: #14b8a6; }
.sp-inspection-tag[data-itype="Wartung EMA"]            { background: #3b82f6; }
.sp-inspection-tag[data-itype="Wartung BMA"]            { background: #ef4444; }
.sp-inspection-tag[data-itype="Wartung Video/EMA"]      { background: #8b5cf6; }
.sp-inspection-tag[data-itype="Wartung Video/BMA"]      { background: #ec4899; }
.sp-inspection-tag[data-itype="Wartung EMA/BMA"]        { background: #6366f1; }
.sp-inspection-tag[data-itype="Wartung Video/EMA/BMA"]  { background: #f97316; }

/* ─── PROJEKTE (Kanban) ─── */
.proj-kanban { display: flex; gap: 1rem; overflow-x: auto; padding: .5rem .25rem 1rem; align-items: flex-start; }
.proj-col { flex: 0 0 280px; background: var(--gray-50, #f8fafc); border: 1px solid var(--gray-200, #e2e8f0); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.proj-col-head { padding: .65rem .8rem; font-weight: 600; font-size: .85rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-200, #e2e8f0); position: sticky; top: 0; background: inherit; border-radius: 10px 10px 0 0; }
.proj-col-head .proj-col-count { background: var(--gray-200, #e2e8f0); color: var(--gray-700, #334155); border-radius: 999px; padding: .05rem .5rem; font-size: .72rem; font-weight: 600; }
.proj-col-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: .45rem; }
.proj-col-body { padding: .6rem; display: flex; flex-direction: column; gap: .55rem; overflow-y: auto; min-height: 60px; }
.proj-col-body.drag-over { background: rgba(59,130,246,.08); outline: 2px dashed rgba(59,130,246,.4); outline-offset: -4px; border-radius: 8px; }
.proj-card { background: #fff; border: 1px solid var(--gray-200, #e2e8f0); border-radius: 8px; padding: .6rem .7rem; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .12s, transform .12s; }
.proj-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.proj-card.dragging { opacity: .5; }
.proj-card-title { font-weight: 600; font-size: .82rem; margin-bottom: .25rem; line-height: 1.25; }
.proj-card-meta { font-size: .72rem; color: var(--gray-500, #64748b); display: flex; flex-direction: column; gap: .15rem; }
.proj-card-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.proj-card-tag { font-size: .68rem; padding: .1rem .4rem; border-radius: 5px; background: var(--gray-100, #f1f5f9); color: var(--gray-600, #475569); }
.proj-card-pl { font-weight: 600; color: var(--gray-700, #334155); }

/* ─── PROJEKT-DETAIL PANEL ─── */
.proj-detail-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1200; display: flex; justify-content: flex-end; }
.proj-detail-overlay.hidden { display: none; }
.proj-detail-panel { width: 560px; max-width: 92vw; background: #fff; height: 100%; display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.18); animation: projSlideIn .18s ease; }
@keyframes projSlideIn { from { transform: translateX(40px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.proj-detail-header { padding: 1rem 1.2rem; border-bottom: 1px solid var(--gray-200, #e2e8f0); display: flex; align-items: center; justify-content: space-between; }
.proj-detail-header h3 { margin: 0; font-size: 1.05rem; }
.proj-detail-body { padding: 1.2rem; overflow-y: auto; flex: 1; }
.proj-detail-section { margin-bottom: 1.4rem; }
.proj-detail-section h4 { margin: 0 0 .6rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500, #64748b); }
.proj-field { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; font-size: .85rem; border-bottom: 1px solid var(--gray-100, #f1f5f9); }
.proj-field .proj-field-label { color: var(--gray-500, #64748b); }
.proj-field .proj-field-val { font-weight: 500; text-align: right; }
.proj-contact-row { padding: .45rem 0; border-bottom: 1px solid var(--gray-100, #f1f5f9); font-size: .85rem; }
.proj-contact-row:last-child { border-bottom: none; }
.proj-contact-name { font-weight: 500; }
.proj-contact-badge { display: inline-block; font-size: .7rem; font-weight: 600; background: var(--primary, #3b82f6); color: #fff; border-radius: 3px; padding: 0 .35rem; margin-left: .3rem; vertical-align: middle; }
.proj-contact-detail { color: var(--gray-600, #475569); margin-top: .15rem; }
.link-subtle { color: inherit; text-decoration: none; }
.link-subtle:hover { text-decoration: underline; }

/* Task-Anhänge */
.task-attach-item{display:flex;align-items:center;gap:.5rem;padding:.35rem .5rem;border-bottom:1px solid #f1f5f9}
.task-attach-item:last-child{border-bottom:none}
.task-attach-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.task-attach-meta{color:#94a3b8;font-size:.78rem;white-space:nowrap}

/* Projekt-Todos */
.muted-sm{color:#94a3b8;font-size:.82rem}
.proj-todo-add{display:flex;gap:.4rem;margin-top:.7rem;flex-wrap:wrap;align-items:center}
.proj-todo-item{display:flex;align-items:center;gap:.5rem;padding:.3rem 0;border-bottom:1px solid #f1f5f9;font-size:.85rem}
.proj-todo-item:last-child{border-bottom:none}
.proj-todo-done .proj-todo-title{text-decoration:line-through;color:#94a3b8}
.proj-todo-title{flex:1;min-width:0}
.proj-todo-dl{font-size:.78rem;color:#64748b;white-space:nowrap}
.proj-todo-overdue{color:#ef4444;font-weight:600}

/* Projekt-Todos */
.muted-sm{color:#94a3b8;font-size:.82rem}
.proj-todo-add{display:flex;gap:.4rem;margin-top:.7rem;flex-wrap:wrap;align-items:center}
.proj-todo-item{display:flex;align-items:center;gap:.5rem;padding:.3rem 0;border-bottom:1px solid #f1f5f9;font-size:.85rem}
.proj-todo-item:last-child{border-bottom:none}
.proj-todo-done .proj-todo-title{text-decoration:line-through;color:#94a3b8}
.proj-todo-title{flex:1;min-width:0}
.proj-todo-dl{font-size:.78rem;color:#64748b;white-space:nowrap}
.proj-todo-overdue{color:#ef4444;font-weight:600}

/* ── Inaktiv-Status: Techniker + User ── */
.btn-xs { padding: .2rem .55rem; font-size: .72rem; }
.tech-card-inactive { opacity: .7; }
.tech-card-inactive:hover { opacity: 1; }
.user-item-inactive { opacity: .65; background: var(--gray-50); }

/* ══════════════ Lager / Warenwirtschaft ══════════════ */
.inv-tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 2px solid var(--gray-100); flex-shrink: 0; background: #fff; padding: 0 1.25rem; margin: 0 -1.25rem; }
.inv-tab { background: none; border: none; padding: .55rem .9rem; font-size: .9rem; font-weight: 600; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.inv-tab:hover { color: var(--gray-700); }
.inv-tab.active { color: var(--primary, #2563eb); border-bottom-color: var(--primary, #2563eb); }
.inv-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.inv-search { flex: 1; min-width: 180px; padding: .5rem .7rem; border: 1px solid var(--gray-200); border-radius: 8px; font-size: .9rem; }
.inv-select { padding: .5rem .7rem; border: 1px solid var(--gray-200); border-radius: 8px; font-size: .9rem; background: #fff; }
.inv-empty { padding: 1.5rem; text-align: center; color: var(--gray-400); font-size: .9rem; }

.inv-article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; }
.inv-article-card { display: flex; gap: .7rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--gray-200); border-radius: 10px; background: #fff; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.inv-article-card:hover { border-color: var(--primary, #2563eb); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.inv-art-thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--gray-50); display: flex; align-items: center; justify-content: center; }
.inv-art-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inv-noimg { font-size: 1.5rem; opacity: .5; }
.inv-art-main { flex: 1; min-width: 0; }
.inv-art-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-art-sub { font-size: .78rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-art-meta { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .25rem; }
.inv-chip { font-size: .68rem; background: var(--gray-100); color: var(--gray-600); padding: .1rem .4rem; border-radius: 5px; }
.inv-chip-sn { background: #ede9fe; color: #6d28d9; }
.inv-chip-fl { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.inv-art-right { text-align: right; flex-shrink: 0; }
.inv-art-qty { font-weight: 700; font-size: 1rem; }
.inv-art-qty small { font-size: .7rem; font-weight: 400; color: var(--gray-400); }
.inv-art-vk { font-size: .78rem; color: var(--gray-500); }
.inv-order-link { font-size: 1.1rem; text-decoration: none; opacity: .65; transition: opacity .15s; line-height: 1; }
.inv-order-link:hover { opacity: 1; }
.inv-filter-cat-row { display: flex; align-items: center; gap: .4rem; font-size: .85rem; cursor: pointer; padding: .1rem 0; }
.inv-filter-cat-row input { cursor: pointer; }
/* Dual-Range-Slider: Thumbs klickbar machen */
#invArtFilterPriceMin, #invArtFilterPriceMax { pointer-events: none; }
#invArtFilterPriceMin::-webkit-slider-thumb, #invArtFilterPriceMax::-webkit-slider-thumb { pointer-events: all; width:18px;height:18px;border-radius:50%;background:var(--primary,#2563eb);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);cursor:pointer;appearance:none;-webkit-appearance:none; }
#invArtFilterPriceMin::-moz-range-thumb, #invArtFilterPriceMax::-moz-range-thumb { pointer-events: all; width:16px;height:16px;border-radius:50%;background:var(--primary,#2563eb);border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);cursor:pointer; }
#invArtFilterEkMin, #invArtFilterEkMax { pointer-events: none; }
#invArtFilterEkMin::-webkit-slider-thumb, #invArtFilterEkMax::-webkit-slider-thumb { pointer-events: all; width:18px;height:18px;border-radius:50%;background:#16a34a;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);cursor:pointer;appearance:none;-webkit-appearance:none; }
#invArtFilterEkMin::-moz-range-thumb, #invArtFilterEkMax::-moz-range-thumb { pointer-events: all; width:16px;height:16px;border-radius:50%;background:#16a34a;border:2px solid #fff;cursor:pointer; }
#invArtFilterQtyMin, #invArtFilterQtyMax { pointer-events: none; }
#invArtFilterQtyMin::-webkit-slider-thumb, #invArtFilterQtyMax::-webkit-slider-thumb { pointer-events: all; width:18px;height:18px;border-radius:50%;background:#d97706;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.25);cursor:pointer;appearance:none;-webkit-appearance:none; }
#invArtFilterQtyMin::-moz-range-thumb, #invArtFilterQtyMax::-moz-range-thumb { pointer-events: all; width:16px;height:16px;border-radius:50%;background:#d97706;border:2px solid #fff;cursor:pointer; }
.inv-low { color: #dc2626; }

/* Ansichts-Toggle (Kacheln / Liste / Kategorien) */
.inv-view-btns { display: flex; border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; }
.inv-view-btn { background: #fff; border: none; padding: .4rem .65rem; font-size: 1rem; cursor: pointer; color: var(--gray-500); line-height: 1; }
.inv-view-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.inv-view-btn.active { background: var(--primary, #2563eb); color: #fff; }
/* "Nur mit Bestand" Toggle */
.inv-toggle-btn { white-space: nowrap; }
.inv-toggle-btn.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); }
/* Kategorie-Gruppenansicht */
.inv-cat-group { margin-bottom: 1rem; }
.inv-cat-heading { font-weight: 700; font-size: .85rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: .04em; padding: .3rem .2rem .4rem; display: flex; align-items: center; gap: .5rem; }
.inv-cat-count { background: var(--gray-100); color: var(--gray-500); font-size: .75rem; font-weight: 600; padding: .1rem .45rem; border-radius: 10px; }
.inv-cat-grid { gap: .5rem; }
/* Sortier-Buttons Bestand */
.inv-sort-btn { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: .4rem .6rem; font-size: .82rem; cursor: pointer; color: var(--gray-500); white-space: nowrap; }
.inv-sort-btn:hover { border-color: var(--gray-400); color: var(--gray-700); }
.inv-sort-btn.active { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); font-weight: 600; }

.inv-list { display: flex; flex-direction: column; gap: .35rem; }
.inv-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--gray-200); border-radius: 8px; background: #fff; }
.inv-row.inv-count-row, .inv-row.inv-sup, .inv-row.inv-loc, .inv-row.inv-pick { cursor: pointer; }
.inv-row.inv-count-row:hover, .inv-row.inv-sup:hover, .inv-row.inv-loc:hover, .inv-row.inv-pick:hover { border-color: var(--primary, #2563eb); }
.inv-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inv-row-sub { font-size: .76rem; color: var(--gray-500); }
.inv-row-qty { font-weight: 700; white-space: nowrap; }
.inv-row-qty small { font-size: .7rem; font-weight: 400; color: var(--gray-400); }
.inv-mov-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; margin-top: .15rem; }
.inv-mov-time { color: var(--gray-600); font-size: .76rem; }
.inv-mov-user { color: var(--gray-500); font-size: .76rem; }
.inv-mov-loc  { color: var(--gray-400); font-size: .76rem; }
.inv-mov-grund { font-size: .82rem; color: #1d4ed8; font-weight: 500; margin-top: .1rem; }
.inv-cat-actions { display: flex; gap: .3rem; }
.inv-cat-actions button { border: none; background: transparent; cursor: pointer; font-size: 1rem; padding: .2rem .35rem; border-radius: 6px; line-height: 1; }
.inv-cat-actions button:hover { background: var(--gray-100, #f1f5f9); }

.inv-admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }

.inv-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: .5rem; }
.inv-table th { text-align: left; font-size: .72rem; text-transform: uppercase; color: var(--gray-400); padding: .35rem .4rem; border-bottom: 1px solid var(--gray-100); }
.inv-table td { padding: .4rem .4rem; border-bottom: 1px solid var(--gray-50); }
.inv-table .ta-r { text-align: right; }
.inv-sec { font-size: .82rem; text-transform: uppercase; color: var(--gray-400); margin: 1.1rem 0 .4rem; letter-spacing: .03em; }

.inv-detail-head { display: flex; gap: 1rem; }
.inv-detail-photo { width: 100px; height: 100px; object-fit: cover; border-radius: 10px; background: var(--gray-50); }
.inv-detail-info { flex: 1; min-width: 0; }
.inv-detail-tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .3rem; }
.inv-detail-sub { font-size: .82rem; color: var(--gray-500); }
.inv-detail-prices { display: flex; gap: 1.2rem; margin-top: .5rem; }
.inv-detail-prices span { font-size: .7rem; text-transform: uppercase; color: var(--gray-400); display: block; }
.inv-detail-prices b { font-size: 1.05rem; }
.inv-detail-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.inv-book-art { font-weight: 600; margin: 0 0 .8rem; }

.inv-photo-row { display: flex; gap: 1rem; align-items: center; margin-bottom: .8rem; }
.inv-photo-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--gray-50); display: none; }
.inv-hint { font-size: .76rem; color: var(--gray-400); margin: .3rem 0 0; }
.inv-known-banner { background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 8px; color: #065f46;
  font-size: .9rem; padding: .55rem .8rem; margin-bottom: .6rem; }
.inv-known-banner.hidden { display: none; }

.inv-scan-wrap { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 10px; overflow: hidden; margin-bottom: .6rem; }
.inv-scan-wrap video { width: 100%; height: 100%; object-fit: cover; }
/* Kleinerer Scan-Bereich: schmales horizontales Fenster in der Mitte */
/* Schmaler horizontaler Scan-Streifen – nur dieser Bereich wird ausgewertet */
.inv-scan-frame { position: absolute; inset: 37% 4%; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0,0,0,.6); pointer-events: none; }
/* Eck-Markierungen statt Vollrahmen */
.inv-scan-corner { position: absolute; width: 18px; height: 18px; border-color: #fff; border-style: solid; }
.inv-scan-corner.tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.inv-scan-corner.tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.inv-scan-corner.bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.inv-scan-corner.br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }
/* Taschenlampen-Button */
.inv-scan-torch { position: absolute; bottom: .6rem; right: .6rem; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3); border-radius: 50%; width: 2.6rem; height: 2.6rem; font-size: 1.25rem; cursor: pointer; display: none; align-items: center; justify-content: center; color: #fff; transition: background .15s; }
.inv-scan-torch.visible { display: flex; }
.inv-scan-torch.on { background: rgba(255,220,50,.75); border-color: #fbbf24; }
.inv-mat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.inv-mat-row { display: flex; justify-content: space-between; font-size: .84rem; padding: .25rem 0; border-bottom: 1px solid var(--gray-50); }

/* OCR Typenschild */
.inv-ocr-preview-row { display: flex; gap: .7rem; align-items: center; margin-bottom: .5rem; }
.inv-ocr-image { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--gray-100); flex: 0 0 auto; }
.inv-ocr-lines { display: flex; flex-direction: column; gap: .4rem; max-height: 50vh; overflow-y: auto; }
.inv-ocr-line { border: 1px solid var(--gray-200); border-radius: 8px; padding: .4rem .55rem; }
.inv-ocr-line.assigned { border-color: #2563eb; background: #eff6ff; }
.inv-ocr-text { font-size: .9rem; font-weight: 600; word-break: break-word; margin-bottom: .35rem; }
.inv-ocr-input { width: 100%; box-sizing: border-box; font-size: .9rem; font-weight: 600; padding: .3rem .45rem; margin-bottom: .35rem; border: 1px solid var(--gray-300); border-radius: 6px; background: #fff; color: var(--gray-800); }
.inv-ocr-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.inv-ocr-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.inv-hersteller-cands { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .45rem; padding: .5rem .55rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; }
.inv-cand-hint { font-size: .72rem; color: var(--gray-500); width: 100%; margin-bottom: .1rem; }
.inv-cand-chip { font-size: .82rem; padding: .3rem .6rem; min-height: 32px; border: 1px solid var(--gray-300); border-radius: 999px; background: #fff; color: var(--gray-700); cursor: pointer; }
.inv-cand-chip:hover { border-color: #2563eb; color: #2563eb; }
.inv-cand-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.inv-device-pick { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15,23,42,.55); }
.inv-device-pick-card { width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto; background: #fff; border-radius: 14px; padding: 1rem; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.inv-device-pick-head { font-weight: 600; font-size: .95rem; margin-bottom: .6rem; color: var(--gray-800); }
.inv-device-pick-item { display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: left; padding: .7rem .8rem; margin-bottom: .5rem; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--gray-50); cursor: pointer; min-height: 44px; }
.inv-device-pick-item:hover { border-color: #2563eb; background: #eff6ff; }
.inv-device-pick-item strong { font-size: .92rem; color: var(--gray-900); }
.inv-device-pick-item span { font-size: .78rem; color: var(--gray-500); }
.inv-device-pick-cancel { width: 100%; margin-top: .2rem; }
.inv-device-pick-all { width: 100%; padding: .8rem; margin-bottom: .7rem; border: none; border-radius: 10px;
  background: #16a34a; color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 48px; }
.inv-device-pick-all:hover { background: #15803d; }
.inv-pick-search { width: 100%; padding: .6rem .7rem; margin-bottom: .6rem; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 16px; min-height: 44px; }
.inv-pick-search:focus { outline: none; border-color: #2563eb; }
.inv-pick-list { display: flex; flex-direction: column; }
.inv-pick-empty { padding: .8rem; text-align: center; color: var(--gray-500); font-size: .85rem; }
.inv-ocr-chip { font-size: .72rem; padding: .18rem .5rem; border: 1px solid var(--gray-300); border-radius: 999px; background: #fff; color: var(--gray-600); cursor: pointer; }
.inv-ocr-chip:hover { border-color: #2563eb; color: #2563eb; }

/* Inventur – Zählkarten mit +/- Stepper */
.inv-count-toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.inv-count-toolbar .inv-search { flex: 1 1 auto; min-height: 44px; font-size: 16px; }
.inv-count-iconbtn { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; line-height: 1; }
.inv-count-list { display: flex; flex-direction: column; gap: .5rem; }
.inv-count-item { display: flex; align-items: center; gap: .55rem; padding: .55rem .6rem; border: 1px solid var(--gray-200); border-radius: 10px; background: #fff; }
.inv-count-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.inv-count-info b { font-size: .9rem; color: var(--gray-900); overflow: hidden; text-overflow: ellipsis; }
.inv-count-info span { font-size: .75rem; color: var(--gray-500); }
.inv-count-stepper { display: flex; align-items: center; gap: .25rem; flex: 0 0 auto; }
.inv-count-stepper .btn { flex: 0 0 40px; width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; line-height: 1; }
.inv-count-stepper input { width: 52px; text-align: center; min-height: 40px; font-size: 16px; border: 1px solid var(--gray-300); border-radius: 8px; padding: 0 .2rem; }
.inv-count-diff { flex: 0 0 auto; min-width: 36px; text-align: right; font-size: .85rem; font-weight: 600; color: var(--gray-500); }
.inv-count-diff.inv-low { color: #dc2626; }
.inv-count-del { flex: 0 0 auto; background: none; border: none; color: var(--gray-400); font-size: 1.1rem; cursor: pointer; padding: .2rem .4rem; }
.inv-count-del:hover { color: #dc2626; }
.inv-count-flash { animation: invCountFlash .8s ease; }
@keyframes invCountFlash { 0% { background: #dcfce7; } 100% { background: #fff; } }
.inv-pick-new { border-style: dashed; color: #2563eb; }

/* Inventar-Export – Spaltenauswahl */
.inv-export-hint { font-size: .85rem; color: var(--gray-600); margin: 0 0 .8rem; }
.inv-export-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; margin-bottom: .8rem; }
.inv-export-col { display: flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--gray-800); cursor: pointer; }
.inv-export-col input { width: 18px; height: 18px; }
.inv-export-actions { display: flex; gap: .5rem; margin-bottom: 1rem; }
.inv-export-buttons { display: flex; gap: .6rem; flex-wrap: wrap; }
.inv-export-buttons .btn { flex: 1 1 auto; min-height: 44px; }
@media (max-width: 480px) { .inv-export-cols { grid-template-columns: 1fr; } }
/* Import */
.inv-import-summary { display: flex; gap: .6rem .8rem; flex-wrap: wrap; margin-bottom: .5rem; }
.inv-import-stat { font-size: .9rem; color: var(--gray-700); }
.inv-import-stat.warn { color: #b45309; }
.inv-import-err-head { font-size: .78rem; color: #6b7280; margin-bottom: .3rem; font-weight: 600; }
.inv-import-errors { max-height: 200px; overflow-y: auto; background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: .5rem .7rem; }
.inv-import-err { font-size: .8rem; color: #92400e; margin-bottom: .2rem; }
/* Platzhalter-Info beim Ausbuchen */
.inv-sn-ph-info { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: .65rem .8rem; }
.inv-sn-ph-info-text { font-size: .88rem; color: #92400e; margin-bottom: .45rem; line-height: 1.45; }

/* Seriennummern nachpflegen */
.inv-pending-row {
  display: flex; align-items: center; gap: .6rem; cursor: pointer;
  padding: .6rem .7rem; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: .5rem;
}
.inv-pending-row:hover { background: #f9fafb; }
.inv-pending-main { flex: 1; min-width: 0; }
.inv-pending-name { font-weight: 600; }
.inv-pending-sub { font-size: .82rem; color: #6b7280; }
.inv-pending-fill { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.inv-pending-no { width: 1.6rem; color: #6b7280; flex: none; text-align: right; }
.inv-pending-input { flex: 1; min-height: 44px; font-size: 16px; box-sizing: border-box; }
.inv-pending-save { flex: none; min-height: 44px; }

/* Schnellerfassung: Checkliste der per Foto erkannten Seriennummern */
.inv-sn-pick-box { margin: .2rem 0 .5rem; }
.inv-sn-pick-head { font-size: .8rem; color: #6b7280; margin-bottom: .35rem; }
.inv-sn-pick { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; margin-bottom: .35rem;
  border: 1px solid var(--gray-200, #e5e7eb); border-radius: 8px; background: #fff; cursor: pointer; }
.inv-sn-pick input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: #16a34a; }
.inv-sn-pick span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; word-break: break-all; }
.inv-sn-pick.on { border-color: #16a34a; background: #ecfdf5; }
.inv-sn-pick:not(.on) span { color: #9ca3af; text-decoration: line-through; }
.inv-sn-pick.dup { border-color: #dc2626; background: #fef2f2; }
.inv-sn-pick.dup span { color: #b91c1c; text-decoration: line-through; }
.inv-sn-pick.dup input[type=checkbox] { accent-color: #dc2626; }
.inv-sn-dup-tag { font-size: .68rem; color: #dc2626; font-weight: 600; margin-left: auto; white-space: nowrap;
  font-family: system-ui, sans-serif; }
.inv-sn-dup-count { color: #dc2626; font-weight: 600; }

/* Platzhalter-Zeile (Stück ohne Seriennummer) im Ausbuch-Auswahldialog */
.inv-sn-ph-row { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; margin-bottom: .35rem;
  border: 1px dashed #d1d5db; border-radius: 8px; background: #f9fafb; }
.inv-sn-ph-label { font-size: .82rem; color: #6b7280; flex: 1; }
.inv-sn-ph-step { display: flex; align-items: center; gap: .5rem; }
.inv-sn-ph-step .btn-sm { min-width: 32px; padding: .25rem .5rem; }
.inv-sn-ph-step span { min-width: 1.4rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Bestätigungsdialog: mehrere verschiedene Artikel auf einem Foto */
.inv-group-card { max-width: 480px; }
.inv-group-loc { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; font-size: .85rem; font-weight: 600; color: #374151; }
.inv-group-loc select { flex: 1; padding: .5rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: .9rem; }
.inv-group-row { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem; margin-bottom: .5rem;
  border: 2px solid #e5e7eb; border-radius: 10px; cursor: pointer; background: #fff; }
.inv-group-row.on { border-color: #16a34a; background: #ecfdf5; }
.inv-group-row input[type=checkbox] { margin-top: .15rem; width: 1.1rem; height: 1.1rem; accent-color: #16a34a; flex: none; }
.inv-group-info { flex: 1; min-width: 0; }
.inv-group-title { font-weight: 700; font-size: .95rem; color: #111827; }
.inv-group-meta { font-size: .78rem; color: #6b7280; margin-top: .1rem; }
.inv-group-sn { font-size: .8rem; color: #374151; margin-top: .25rem; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inv-group-sn .inv-sn-dup { color: #b91c1c; text-decoration: line-through; }
.inv-group-sn .inv-sn-dup-note { color: #dc2626; font-weight: 600; font-family: system-ui, sans-serif; }
.inv-group-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.inv-group-actions .btn { flex: 1; }

/* Schnellerfassung – mobil-optimiertes, klares Layout */
#invQuickModal .modal-body { padding: 1rem; }
#invQuickModal .form-group { margin-bottom: .7rem; }
#invQuickModal .form-row { gap: .7rem; margin-bottom: .2rem; }
#invQuickModal input[type="text"],
#invQuickModal input[type="number"],
#invQuickModal select {
  width: 100%; box-sizing: border-box; min-height: 44px;
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  padding: .5rem .6rem; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff;
}
#invQuickModal input:focus, #invQuickModal select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
#invQuickModal .btn { min-height: 44px; }
/* Eingabezeilen mit Buttons sauber vertikal mittig ausrichten */
#invQuickModal .form-group > div[style*="flex"] { align-items: center; }
/* Quadratische Icon-Buttons: exakt 44x44, Icon perfekt zentriert, gleiche Höhe wie Inputs */
#invQuickModal #invQuickMinus,
#invQuickModal #invQuickPlus,
#invQuickModal #invQuickScanSerial,
#invQuickModal #invQuickHerstellerGuess {
  flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px;
  padding: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; line-height: 1;
}
#invQuickModal #invQuickQty { min-width: 0; }
/* Erfassungs-Buttons (Barcode/Typenschild) volle Breite, nebeneinander */
#invQuickModal #invQuickScanBtn, #invQuickModal #invQuickAiBtn { flex: 1 1 0; min-width: 0; }
/* Aktionsleiste unten: Buttons gleich groß, Speichern dominant */
#invQuickModal .modal-body > div:last-child { gap: .6rem; }
#invQuickModal #invQuickSaveBtn { flex: 1 1 auto; }
.inv-ocr-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.inv-ocr-chip.clear { color: #b91c1c; border-color: #fecaca; }
.inv-ocr-chip.clear:hover { background: #fee2e2; }

/* ─── Statistik / Übersicht ─────────────────────────────────── */
.inv-stats-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1.2rem; }
.inv-stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: .9rem .8rem .7rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.inv-stat-card.warn { border-color: #fca5a5; background: #fff7f7; }
.inv-stat-icon { font-size: 1.4rem; line-height: 1; }
.inv-stat-val { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); }
.inv-stat-val.big { font-size: 1.1rem; color: #15803d; }
.inv-stat-card.warn .inv-stat-val { color: #b91c1c; }
.inv-stat-label { font-size: .72rem; color: var(--gray-500); text-align: center; }
.inv-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.inv-stats-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: .9rem 1rem; overflow: hidden; }
.inv-stats-head { font-size: .85rem; font-weight: 700; color: var(--gray-700); margin-bottom: .6rem; }
.inv-stats-head.warn { color: #b91c1c; }
.inv-stats-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.inv-stats-table th { text-align: left; color: var(--gray-500); font-weight: 600; border-bottom: 1px solid #f3f4f6; padding: .3rem .4rem; font-size: .76rem; }
.inv-stats-table td { padding: .35rem .4rem; border-bottom: 1px solid #f9fafb; color: var(--gray-800); vertical-align: top; }
.inv-stats-table tr:last-child td { border-bottom: none; }
.inv-stats-table .r { text-align: right; }
.inv-stats-table .warn { color: #b91c1c; font-weight: 600; }
.inv-stats-link { color: var(--primary); cursor: pointer; text-decoration: underline; text-decoration-color: transparent; }
.inv-stats-link:hover { text-decoration-color: var(--primary); }
.inv-stats-ts { color: var(--gray-400); font-size: .76rem; white-space: nowrap; }
.inv-loc-chip { display: inline-block; padding: .1rem .45rem; border-radius: 5px; font-size: .78rem; }
.inv-loc-chip.inv-loc-main { background: #dbeafe; color: #1d4ed8; }
.inv-loc-chip.inv-loc-van  { background: #dcfce7; color: #15803d; }
.inv-loc-chip.inv-loc-site { background: #fef9c3; color: #854d0e; }
.inv-mv-badge { display: inline-block; font-size: .72rem; padding: .1rem .4rem; border-radius: 5px; white-space: nowrap; }
.inv-mv-badge.inv-mv-in      { background: #dcfce7; color: #15803d; }
.inv-mv-badge.inv-mv-out     { background: #fee2e2; color: #b91c1c; }
.inv-mv-badge.inv-mv-transfer{ background: #dbeafe; color: #1d4ed8; }
.inv-mv-badge.inv-mv-adjust  { background: #fef3c7; color: #92400e; }
.inv-mv-badge.inv-mv-install { background: #ede9fe; color: #6d28d9; }
@media (max-width: 800px) { .inv-stats-row { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  .inv-article-grid { grid-template-columns: 1fr; }
  .inv-detail-head { flex-direction: column; }
}}

/* ─── Warenkörbe ─── */
.inv-cart-row { cursor: pointer; }
.inv-cart-row:hover { background: var(--gray-50, #f9fafb); }
.inv-grund-dropdown { position:absolute; left:0; right:0; top:100%; z-index:200; background:#fff; border:1px solid var(--gray-200,#e5e7eb); border-radius:6px; box-shadow:0 4px 12px rgba(0,0,0,.12); max-height:180px; overflow-y:auto; }
.inv-grund-dropdown.hidden { display:none; }
.inv-grund-opt { padding:.45rem .75rem; cursor:pointer; font-size:.9rem; display:flex; align-items:center; gap:.5rem; }
.inv-grund-opt:hover { background:var(--gray-50,#f9fafb); }
.inv-grund-opt .inv-chip { font-size:.7rem; }

/* ── Artikel-Verknüpfungen (Relations) ────────────────────── */
.inv-rel-group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.inv-rel-type-label { font-size: .72rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; min-width: 5.5rem; }
.inv-rel-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 20px; padding: .25rem .7rem .25rem .65rem; font-size: .82rem; cursor: pointer; transition: background .12s, border-color .12s; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-rel-chip:hover { background: #dbeafe; border-color: #93c5fd; }
.inv-rel-chip em { color: var(--gray-500); font-style: normal; }
.inv-rel-remove { background: none; border: none; cursor: pointer; font-size: .9rem; color: var(--gray-400); padding: 0 0 0 .2rem; line-height: 1; flex-shrink: 0; }
.inv-rel-remove:hover { color: #dc2626; }
.inv-rel-add { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.inv-rel-results { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.1); max-height: 220px; overflow-y: auto; position: relative; z-index: 50; }
.inv-rel-results li { padding: .45rem .75rem; cursor: pointer; font-size: .88rem; display: flex; align-items: center; gap: .4rem; }
.inv-rel-results li:hover { background: var(--gray-50); }
.inv-rel-results li em { color: var(--gray-500); font-style: normal; }
.inv-rel-cat { margin-left: auto; font-size: .72rem; color: var(--gray-400); white-space: nowrap; }
.inv-rel-no-result { color: var(--gray-400); font-style: italic; pointer-events: none; }
.inv-empty-inline { color: var(--gray-400); font-size: .85rem; font-style: italic; }

/* ── Preislisten-Review-Tabelle ───────────────────────────── */
.inv-pl-review-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.inv-pl-review-row:hover { background: var(--gray-50); }
.inv-pl-review-row td { vertical-align: middle; }
