/* ═══════════════════════════════════════════════════════
   CRM — Premium Mobile Design System
   ═══════════════════════════════════════════════════════ */

/* ── Design Tokens: Light (default) ───────────────────── */
:root {
  /* Colors */
  --bg: #fafaf9;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-sunken: #f4f4f2;
  --border: #e8e8e6;
  --border-strong: #d5d5d1;

  --ink: #0b0b0a;
  --ink-2: #2a2a28;
  --ink-3: #6b6b67;
  --ink-4: #9a9a95;

  --accent: oklch(0.52 0.14 155);
  --accent-hover: oklch(0.47 0.15 155);
  --accent-tint: oklch(0.96 0.03 155);
  --accent-fg: #ffffff;

  --warn: oklch(0.55 0.18 25);
  --warn-tint: oklch(0.96 0.04 25);
  --amber: oklch(0.65 0.14 75);
  --amber-tint: oklch(0.96 0.04 75);
  --info: oklch(0.55 0.11 240);
  --info-tint: oklch(0.96 0.03 240);

  /* Shadows */
  --shadow-xs: 0 1px 1px rgba(11,11,10,0.04);
  --shadow-sm: 0 1px 2px rgba(11,11,10,0.05), 0 1px 3px rgba(11,11,10,0.04);
  --shadow-md: 0 4px 12px rgba(11,11,10,0.06), 0 2px 4px rgba(11,11,10,0.04);
  --shadow-lg: 0 12px 32px rgba(11,11,10,0.08), 0 4px 12px rgba(11,11,10,0.04);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Layout */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --tap: 44px;
  --nav-height: 64px;

  /* Motion */
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 360ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ── Dark Theme ───────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-raised: #141416;
  --surface: #141416;
  --surface-sunken: #0f0f11;
  --border: #26262a;
  --border-strong: #36363b;

  --ink: #fafafa;
  --ink-2: #e4e4e7;
  --ink-3: #a1a1aa;
  --ink-4: #6b6b71;

  --accent: oklch(0.74 0.16 155);
  --accent-hover: oklch(0.80 0.15 155);
  --accent-tint: oklch(0.34 0.09 155 / 0.35);
  --accent-fg: #0a0a0b;

  --warn: oklch(0.72 0.17 25);
  --warn-tint: oklch(0.34 0.09 25 / 0.35);
  --amber: oklch(0.78 0.15 75);
  --amber-tint: oklch(0.34 0.09 75 / 0.35);
  --info: oklch(0.72 0.13 240);
  --info-tint: oklch(0.34 0.09 240 / 0.35);

  --shadow-xs: 0 1px 1px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.55), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.65), 0 4px 12px rgba(0,0,0,0.3);
}

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

html { height: 100%; }
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: 'cv11', 'ss01';
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
body.has-nav { padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 60px); }

#app {
  display: block;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}

a { color: inherit; text-decoration: none; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Screen Scaffold ──────────────────────────────────── */
.screen { display: block; }
.screen-body { padding: 20px 16px; }

/* ── Spinner / Skeleton ───────────────────────────────── */
.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot-spinner, .loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 48px;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 0%, var(--border) 50%, var(--surface-sunken) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  height: 86px;
  border-radius: var(--r-lg);
  margin-bottom: 10px;
}
.skeleton-hero {
  height: 220px;
  border-radius: var(--r-xl);
  margin-bottom: 24px;
}

/* ── Offline-Banner (oben eingefahren, wenn offline oder Queue aktiv) ─────── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: #dc2626; /* solides Rot, sichtbar auf Light & Dark */
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-100%);
  transition: transform 220ms var(--ease);
  pointer-events: none;
}
.offline-banner.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}
.offline-banner.is-warn { background: #d97706; } /* Queue wird synchronisiert */
.offline-banner::before {
  content: "●";
  display: inline-block;
  margin-right: 8px;
  animation: offline-pulse 1.4s ease-in-out infinite;
}
@keyframes offline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
/* Wenn Banner sichtbar ist: Top-Header nach unten schieben, damit er nicht verdeckt wird */
body.has-offline-banner .top-header,
body.has-offline-banner .top-header-detail { padding-top: calc(max(16px, env(safe-area-inset-top, 0px)) + 42px); }

/* ── Top Header (sticky) ──────────────────────────────── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: max(16px, calc(var(--safe-top) + 8px)) 16px 12px;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.top-header-detail {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: max(8px, calc(var(--safe-top) + 4px)) 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
}

.header-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.header-title-l {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 2px 0 0;
  line-height: 1.05;
}
.header-title-m {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  letter-spacing: -0.01em;
}
.header-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  flex: 1;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.icon-btn:active { background: var(--surface-sunken); border-color: var(--ink-3); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn-accent {
  color: var(--accent);
  background: var(--accent-tint);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.icon-btn-accent:active { filter: brightness(0.95); }
.icon-btn-plain {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.icon-btn-plain:active { background: var(--surface-sunken); }

.icon-btn-dot {
  position: relative;
}
.icon-btn-dot::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent);
}
.icon-btn-dot.dot-wichtig::after { background: var(--amber); box-shadow: none; }

.header-action {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-fg);
  background: var(--accent);
  padding: 10px 16px;
  min-height: 40px;
  border-radius: var(--r-md);
  transition: filter var(--t-fast) var(--ease);
  letter-spacing: -0.005em;
}
.header-action:active { filter: brightness(0.92); }
.header-action:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Bottom Nav ───────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg-raised) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  display: none;
  z-index: 100;
}
body.has-nav .bottom-nav { display: flex; }

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-4);
  transition: color var(--t-fast) var(--ease);
  min-height: var(--tap);
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-item.active {
  color: var(--ink);
}
.nav-item.active .nav-item-label { font-weight: 600; }

/* ── Hero Next-Stop Card ──────────────────────────────── */
.hero-next {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-meta::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-tint);
  animation: hero-pulse 2s ease-in-out infinite;
}
@keyframes hero-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-tint); }
  50% { box-shadow: 0 0 0 10px transparent; }
}
.hero-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}
.hero-addr {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.4;
  margin-top: 2px;
}
.hero-hint {
  font-size: 13px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-weight: 500;
  line-height: 1.4;
}
.hero-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 2px;
}
.hero-actions-3 { grid-template-columns: 1fr 1fr 1fr; }
.hero-actions-3 .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; overflow: hidden; min-width: 0; text-decoration: none;
}
.hero-actions-3 .btn > * { flex: 0 0 auto; }
@media (max-width: 600px) {
  .hero-actions-3 { gap: 6px; }
  /* Auf engen Bildschirmen Icons in den Hero-Buttons ausblenden, Text bleibt. */
  .hero-actions-3 .btn svg { display: none; }
  .hero-actions-3 .btn { padding-left: 8px; padding-right: 8px; font-size: 13px; }
}

/* ── Tour Strip + Progress ────────────────────────────── */
.tour-strip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 10px;
  gap: 12px;
}
.tour-strip-label { font-size: 13px; color: var(--ink-3); }
.tour-strip-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.tour-strip-count strong { color: var(--accent); font-weight: 700; }

.progress-track {
  height: 3px;
  background: var(--surface-sunken);
  border-radius: var(--r-full);
  overflow: hidden;
  margin: 0 4px 22px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--t-slow) var(--ease);
}

/* ── Section Header ───────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 4px 10px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}
.section-meta { font-size: 12px; color: var(--ink-3); }

/* ── Stop List ────────────────────────────────────────── */
.stop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stop-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-height: 64px;
  text-align: left;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  color: var(--ink);
  box-sizing: border-box;
}
.stop-card:active {
  background: var(--surface-sunken);
  transform: scale(0.99);
}
.stop-current {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.stop-done { opacity: 0.55; }
.stop-done .stop-name { text-decoration: line-through; text-decoration-color: var(--ink-4); }

.stop-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.stop-number svg { width: 16px; height: 16px; }
.stop-current .stop-number {
  background: var(--accent);
  color: var(--accent-fg);
}
.stop-done .stop-number {
  background: var(--accent);
  color: var(--accent-fg);
}
.stop-body { flex: 1; min-width: 0; }
.stop-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stop-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}
.stop-chevron { color: var(--ink-4); flex-shrink: 0; }
.stop-chevron svg { width: 18px; height: 18px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  transition: filter var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(11,11,10,0.08), inset 0 1px 0 rgba(255,255,255,0.08);
}
.btn-primary:active { filter: brightness(0.9); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:active { background: var(--surface-sunken); border-color: var(--ink-4); }
.btn-secondary:disabled,
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--ink-4);
  background: var(--surface-sunken);
}

.btn-tonal {
  background: var(--accent-tint);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-tonal:active { filter: brightness(0.96); }

.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:active { background: var(--surface-sunken); }

.btn-danger {
  background: var(--warn-tint);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}
.btn-danger:active { filter: brightness(0.95); }

.btn-lg { min-height: 56px; font-size: 16px; padding: 16px 22px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 56px 24px;
  text-align: center;
  gap: 6px;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.empty-sub { font-size: 13px; max-width: 320px; line-height: 1.5; color: var(--ink-3); }
.empty-mini { padding: 32px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: max(calc(var(--nav-height) + var(--safe-bottom) + 16px), 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s var(--ease);
  max-width: calc(100vw - 40px);
}
.toast-success { background: var(--accent); color: var(--accent-fg); }
.toast-error { background: var(--warn); color: #fff; }
@keyframes toast-in {
  from { transform: translate(-50%, 12px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ── Bottom Sheet ─────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}
.sheet-overlay.sheet-open { opacity: 1; }
.sheet {
  width: 100%;
  background: var(--bg-raised);
  border-radius: 20px 20px 0 0;
  padding: 6px 16px max(20px, var(--safe-bottom));
  max-height: 84vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s var(--ease);
  box-shadow: var(--shadow-lg);
}
.sheet-open .sheet { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--r-full);
  margin: 8px auto 14px;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: var(--ink); }
.sheet-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  border-radius: var(--r-full);
}
.sheet-close:active { background: var(--surface-sunken); }
.sheet-close svg { width: 18px; height: 18px; }
.sheet-body { font-size: 14px; padding-bottom: 8px; color: var(--ink-2); }

.sheet-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sheet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px;
  text-align: left;
  font-size: 15px;
  border-radius: var(--r-md);
  width: 100%;
  color: var(--ink);
}
.sheet-option:active { background: var(--surface-sunken); }
.sheet-option.active { color: var(--accent); font-weight: 600; }
.sheet-option svg { width: 16px; height: 16px; }

/* ── Kunde Detail ─────────────────────────────────────── */
.kunde-head { margin: 4px 0 18px; }

/* Mini-Status-Bar im Header — Letzter Besuch + Rhythmus auf einen Blick.
   Aufbau: dünne Progress-Leiste, darunter Text-Zeile (links Status, rechts Soll). */
.kunde-status-bar {
  margin: 12px 0 8px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  position: relative;
  overflow: hidden;
}
.kunde-status-bar-fill {
  height: 5px;
  background: var(--accent);
  border-radius: var(--r-sm);
  transition: width 240ms ease;
}
.kunde-status-bar-text {
  padding: 6px 2px 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.kunde-status-empty .kunde-status-bar-fill { background: var(--border); }
.kunde-order-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--warn) 8%, var(--bg-raised));
  color: var(--ink);
}
.kunde-order-alert strong {
  display: block;
  color: var(--warn);
  font-size: 13px;
}
.kunde-order-alert span {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  margin-top: 1px;
}
.kunde-order-alert.order-need-critical {
  border-color: color-mix(in srgb, #ef4444 30%, transparent);
  background: color-mix(in srgb, #ef4444 10%, var(--bg-raised));
}

/* Sync-Status als unauffälliger Footer am Seitenende (nicht mehr im Header) */
.sync-status-footer {
  margin: 24px 0 8px;
  padding: 8px 12px;
  background: transparent;
  border-top: 1px solid var(--border);
  border-bottom: none;
  color: var(--ink-4);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.sync-status-footer button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  font-family: inherit;
}
.sync-status-footer svg { width: 14px; height: 14px; opacity: 0.6; }

@media (max-width: 640px) {
  .kunde-status-bar-text { font-size: 11px; }
}
.kunde-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.15;
  color: var(--ink);
}
.kunde-zusatz {
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 4px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 76px;
  color: var(--ink);
  transition: background var(--t-fast) var(--ease);
}
.quick-action:active { background: var(--surface-sunken); }
.quick-action svg { width: 20px; height: 20px; color: var(--ink-2); }
.quick-action-label { font-size: 11px; color: var(--ink-2); font-weight: 500; }
.quick-action-primary { border-color: var(--accent); background: var(--accent-tint); }
.quick-action-primary svg { color: var(--accent); }
.quick-action-primary .quick-action-label { color: var(--accent); font-weight: 600; }

.section { margin-bottom: 20px; }
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 8px;
  padding: 0 2px;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

.info-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px 14px;
  font-size: 14px;
}
.info-label { color: var(--ink-3); font-size: 13px; }
.info-value { color: var(--ink); }

/* ── Chips ────────────────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  color: var(--ink-2);
  font-weight: 500;
  border: 1px solid var(--border);
}
.chip-accent { background: var(--accent-tint); color: var(--accent); border-color: transparent; }
.chip-warn { background: var(--warn-tint); color: var(--warn); border-color: transparent; }
.chip-amber { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.chip-info { background: var(--info-tint); color: var(--info); border-color: transparent; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  padding: 14px 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  min-height: var(--tap);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-content { padding: 18px 0; }

/* ── Visit Items (Verlauf) ────────────────────────────── */
.visit-item {
  position: relative;
  padding: 14px 16px;
  background: var(--visit-bg, var(--bg-raised));
  border: 1.5px solid var(--visit-border, var(--border));
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
  color: var(--ink);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
  display: block;
  box-sizing: border-box;
}
.visit-item:active { transform: scale(0.995); filter: brightness(0.97); }

.visit-item.color-accent {
  --visit-bg: color-mix(in srgb, var(--accent-tint) 90%, var(--bg-raised));
  --visit-border: color-mix(in srgb, var(--accent) 25%, transparent);
  --visit-fg: var(--accent);
}
.visit-item.color-info {
  --visit-bg: color-mix(in srgb, var(--info-tint) 90%, var(--bg-raised));
  --visit-border: color-mix(in srgb, var(--info) 25%, transparent);
  --visit-fg: var(--info);
}
.visit-item.color-amber {
  --visit-bg: color-mix(in srgb, var(--amber-tint) 90%, var(--bg-raised));
  --visit-border: color-mix(in srgb, var(--amber) 28%, transparent);
  --visit-fg: var(--amber);
}
.visit-item.color-warn {
  --visit-bg: color-mix(in srgb, var(--warn-tint) 90%, var(--bg-raised));
  --visit-border: color-mix(in srgb, var(--warn) 28%, transparent);
  --visit-fg: var(--warn);
}
.visit-item.color-neutral {
  --visit-bg: var(--bg-raised);
  --visit-border: var(--border);
  --visit-fg: var(--ink-3);
}

/* "nicht angetroffen" — dezenter Warn-Border-Links, Text bleibt voll lesbar */
.visit-item.visit-not-met {
  border-left-width: 4px;
  border-left-color: var(--warn);
}

/* Mobile: kompakte Verlauf-Darstellung — 1 Zeile Teaser; voll sichtbar beim Tap auf Detail-Sheet */
@media (max-width: 899px) {
  .visit-item {
    padding: 10px 14px;
    margin-bottom: 6px;
  }
  .visit-item .visit-head { margin-bottom: 4px; gap: 6px; }
  .visit-item .visit-text {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
  }
  .visit-item .chip-row,
  .visit-item .visit-footer,
  .visit-item > [style*="display:flex; gap:6px; margin-top:10px"] {
    display: none !important;
  }
}

.visit-item.priority-wichtig {
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 30%, transparent);
}
.visit-item.priority-dringend {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent), var(--shadow-sm);
}

.visit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.visit-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--visit-fg) 20%, transparent);
  color: var(--visit-fg);
}
.visit-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
}
.visit-date { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.visit-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.visit-rel { font-size: 11px; color: var(--ink-3); }
.visit-text { font-size: 14px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; }
.visit-text-empty { font-style: italic; color: var(--ink-4); }
.visit-footer {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.visit-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-3);
  margin-right: 4px;
}
.visit-author-avatar {
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Priority badges */
.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: var(--r-full);
}
.priority-badge.pri-wichtig {
  background: var(--amber);
  color: #fff;
}
.priority-badge.pri-dringend {
  background: var(--warn);
  color: #fff;
  animation: pulse-urgent 1.8s ease-in-out infinite;
}
.priority-badge.pri-overdue {
  background: color-mix(in srgb, var(--warn) 15%, var(--bg-raised));
  color: var(--warn);
  border: 1px solid var(--warn);
}

/* Task filter chips */
.task-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.task-filter-bar::-webkit-scrollbar { display: none; }
.task-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.task-filter-chip:hover { background: var(--surface-sunken); }
.task-filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.task-filter-chip .chip-count {
  font-size: 11px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, currentColor 15%, transparent);
  min-width: 18px;
  text-align: center;
}

/* Task rail (Farbbalken links je nach Priorität) */
.task-rail {
  width: 4px;
  border-radius: var(--r-full);
  background: var(--ink-4);
  flex-shrink: 0;
  align-self: stretch;
}
.task-rail.priority-wichtig { background: var(--amber); }
.task-rail.priority-dringend { background: var(--warn); }

.inbox-item.task-done {
  opacity: 0.65;
  background: var(--surface-sunken);
}
.inbox-item.task-done .inbox-title { text-decoration: line-through; color: var(--ink-3); }
.inbox-item.task-overdue { border-color: var(--warn); }

.task-source-hint {
  font-size: 10px;
  color: var(--ink-4);
  font-style: italic;
  letter-spacing: 0.02em;
}
.task-cust-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--r-full);
  border: none;
  cursor: pointer;
}
.task-cust-chip:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* Dashboard Task-Row (im "Meine Aufgaben"-Widget) */
.dash-task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.dash-task-row:last-child { border-bottom: none; }
.dash-task-main { flex: 1; min-width: 0; }
.dash-task-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dash-task-due { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dash-task-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.dash-task-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.35; }
.dash-task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.dash-task-actions .icon-btn { width: 32px; height: 32px; }

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.sheet-body .form-field { margin-bottom: 14px; }
.sheet-body .form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.sheet-body .form-field .input,
.sheet-body .form-field .textarea,
.sheet-body .form-field input[type="text"],
.sheet-body .form-field input[type="date"],
.sheet-body .form-field select,
.sheet-body .form-field textarea {
  width: 100%;
  box-sizing: border-box;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sheet-actions-danger { margin-right: auto; }
@keyframes pulse-urgent {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 50%, transparent); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* Mention chips (@user) */
.mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px 3px 4px;
  border-radius: var(--r-full);
  background: var(--info-tint);
  color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
}
.mention-chip-avatar {
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--info);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.mention-chip.resolved {
  opacity: 0.55;
  text-decoration: line-through;
}

/* User Picker (inline Mentions) */
.user-picker {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* Multi-Select-Dropdown für "Kollegen benachrichtigen" — kompakte Pills + Picker-Liste auf Klick */
.mention-picker {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mention-picker-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.mention-picker-summary::-webkit-details-marker { display: none; }
.mention-pills {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}
.mention-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 8px;
  background: var(--accent-tint, #e8f5ec);
  color: var(--accent, #16a34a);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.mention-pill-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-raised, #fff);
  color: var(--accent, #16a34a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.mention-pill-x {
  border: 0;
  background: transparent;
  color: var(--accent, #16a34a);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 6px 0 4px;
  border-radius: 50%;
}
.mention-pill-x:hover { background: rgba(0,0,0,0.06); }
.mention-picker-chev {
  display: inline-flex;
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  transition: transform 150ms ease;
}
.mention-picker[open] .mention-picker-chev { transform: rotate(180deg); }
.mention-picker-options {
  border-top: 1px solid var(--border);
  max-height: 320px;
  overflow-y: auto;
}
.mention-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.mention-option:last-child { border-bottom: none; }
.mention-option:hover { background: var(--surface-sunken); }
.mention-option.is-active { background: var(--accent-tint, #e8f5ec); }
.mention-option-check {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #16a34a);
}
.mention-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-sunken, #f5f5f5);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.mention-option-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.mention-option-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.mention-option-role { font-size: 11px; color: var(--ink-3); }
.user-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  width: 100%;
  text-align: left;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease);
  min-height: var(--tap);
}
.user-picker-row:last-child { border-bottom: none; }
.user-picker-row:active { background: var(--surface-sunken); }
.user-picker-row.active { background: var(--accent-tint); }

.user-picker-check {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: all var(--t-fast) var(--ease);
}
.user-picker-row.active .user-picker-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.user-picker-check svg { width: 14px; height: 14px; }

.user-picker-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.user-picker-row.active .user-picker-avatar {
  background: var(--accent);
  color: var(--accent-fg);
}
.user-picker-body { flex: 1; min-width: 0; }
.user-picker-name { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.user-picker-role { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* Priority selector (Erfassen) */
.priority-select {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.priority-opt {
  padding: 12px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
}
.priority-opt[data-value="normal"].active {
  border-color: var(--ink-3);
  background: var(--surface-sunken);
  color: var(--ink);
}
.priority-opt[data-value="wichtig"].active {
  border-color: var(--amber);
  background: var(--amber-tint);
  color: var(--amber);
}
.priority-opt[data-value="dringend"].active {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn);
}
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: currentColor;
}

/* Inbox Items */
.inbox-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  color: var(--ink);
  text-align: left;
  width: 100%;
  transition: background var(--t-fast) var(--ease);
}
.inbox-item:active { background: var(--surface-sunken); }
.inbox-item.priority-dringend { border-color: var(--warn); border-width: 1.5px; }
.inbox-item.priority-wichtig { border-color: color-mix(in srgb, var(--amber) 45%, transparent); border-width: 1.5px; }

.inbox-body { flex: 1; min-width: 0; }
.inbox-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.inbox-title { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.inbox-meta { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.inbox-text { font-size: 13px; line-height: 1.4; color: var(--ink-2); margin-top: 4px; }
.inbox-footer { margin-top: 10px; display: flex; gap: 8px; }

/* ── Regal-Table ──────────────────────────────────────── */
.data-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 10px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.regal-on, .regal-off {
  display: inline-block;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
}
.regal-on { background: var(--ink); color: var(--bg); }
.regal-off { color: var(--ink-4); border: 1px solid var(--border-strong); }

/* Regal-Card-Liste (mobile-freundlich statt Tabelle) */
.regal-list { display: flex; flex-direction: column; gap: 8px; }
.regal-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  color: var(--ink);
  transition: background var(--t-fast) var(--ease);
}
.regal-card:active { background: var(--surface-sunken); }
.regal-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.regal-card-cat { font-weight: 600; font-size: 15px; letter-spacing: -0.005em; }
.regal-card-meter { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.regal-card-platz { display: flex; flex-wrap: wrap; gap: 6px; }
.platz-chip {
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-sunken);
  color: var(--ink-4);
  border: 1px solid var(--border);
}
.platz-chip.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ── Mitbewerber ──────────────────────────────────────── */
.mitb-row {
  display: grid;
  grid-template-columns: 1fr 72px 44px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.mitb-row:last-child { border-bottom: none; }
.mitb-bar {
  display: block;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: var(--r-full);
  overflow: hidden;
}
.mitb-fill { display: block; height: 100%; border-radius: inherit; }
.mitb-pct { font-size: 12px; color: var(--ink-3); text-align: right; font-family: var(--font-mono); }

/* ── Form ─────────────────────────────────────────────── */
.form-section { margin-bottom: 22px; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.input, .textarea, .select-btn {
  width: 100%;
  padding: 14px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.55;
}
.select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  min-height: var(--tap);
}
.select-btn svg { width: 16px; height: 16px; color: var(--ink-3); }

/* ── Erfassen Context ─────────────────────────────────── */
.erfassen-context {
  background: var(--bg-raised);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 22px;
}

/* ── Status-Toggle ────────────────────────────────────── */
.status-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-3);
  min-height: var(--tap);
  transition: all var(--t-fast) var(--ease);
}
.status-btn svg { width: 16px; height: 16px; }
.status-btn.active {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

/* ── Tag-Buttons ──────────────────────────────────────── */
.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-btn {
  padding: 9px 14px;
  font-size: 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  transition: all var(--t-fast) var(--ease);
}
.tag-btn.active {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 500;
}
.tag-btn.group-status.active { border-color: var(--warn); background: var(--warn-tint); color: var(--warn); }
.tag-btn.group-saison.active { border-color: var(--amber); background: var(--amber-tint); color: var(--amber); }
.tag-btn.group-sonstiges.active { border-color: var(--info); background: var(--info-tint); color: var(--info); }
.tag-btn.group-ergebnis.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }

/* ── Mic / Recorder ───────────────────────────────────── */
.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
}
.mic-btn svg { width: 14px; height: 14px; }
.mic-btn.recording {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-tint);
}

.recorder {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--warn-tint);
  border: 1px solid var(--warn);
  border-radius: var(--r-md);
}
.recorder-pulse {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--warn);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-bg 1.4s ease-out infinite;
}
.recorder-pulse svg { width: 18px; height: 18px; }
@keyframes pulse-bg {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.92); opacity: 0.7; }
}
.recorder-text { flex: 1; min-width: 0; }
.recorder-title { font-size: 13px; font-weight: 600; color: var(--warn); }
.recorder-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.waveform { display: flex; gap: 2.5px; align-items: end; height: 28px; }
.waveform span {
  width: 3px;
  background: var(--warn);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}
.waveform span:nth-child(2n) { animation-delay: 0.1s; }
.waveform span:nth-child(3n) { animation-delay: 0.2s; }
@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
}

/* ── Customer Photo Gallery ───────────────────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-tile-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  color: #fff;
  padding: 18px 8px 6px;
  font-size: 10px;
  line-height: 1.3;
  pointer-events: none;
}
.photo-tile-meta-name { font-weight: 600; }
.photo-tile-meta-time { opacity: 0.85; font-variant-numeric: tabular-nums; }
.photo-tile-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}
.photo-tile-del:active { background: rgba(0,0,0,0.75); }
.photo-tile-del svg { width: 14px; height: 14px; }

.photo-log {
  margin-top: 18px;
}
.photo-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-3);
}
.photo-log-row:last-child { border-bottom: none; }
.photo-log-row .visit-author-avatar { width: 22px; height: 22px; font-size: 9px; }

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.photo-lightbox-close {
  position: absolute;
  top: max(12px, var(--safe-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

/* ── Photo (alt — Erfassen-Flow) ──────────────────────── */
.photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  width: 100%;
  justify-content: center;
  min-height: var(--tap);
}
.photo-btn svg { width: 18px; height: 18px; }
.photo-preview { margin-top: 12px; }
.photo-thumb {
  width: 120px;
  height: 120px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Sticky Bottom Actions ────────────────────────────── */
.sticky-actions {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 16px -16px 0;
  padding: 12px 16px max(12px, var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}

/* ── Search Input ─────────────────────────────────────── */
.search-field {
  position: relative;
  margin: 2px 0 16px;
}
.search-field input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--ink);
  transition: all var(--t-fast) var(--ease);
}
.search-field input::placeholder { color: var(--ink-4); }
.search-field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.search-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}

/* ── Kunden-Liste Items ───────────────────────────────── */
.customer-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  text-align: left;
  transition: background var(--t-fast) var(--ease);
  margin-bottom: 6px;
  min-height: 44px;
  text-decoration: none; /* Falls als <a> gerendert: kein Underline */
  cursor: pointer;
}
a.customer-row { color: var(--ink); }
a.customer-row:hover { text-decoration: none; }
.customer-row:active { background: var(--surface-sunken); }
.customer-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--surface-sunken);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.customer-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.customer-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.customer-icon-emoji { font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.kunde-head-symbol {
  font-size: 34px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
  flex-shrink: 0;
}
.kunde-head-symbol-icon { color: var(--accent); }
.kunde-head-symbol-icon svg { width: 26px; height: 26px; stroke-width: 1.8; }
.info-value-empty { color: var(--ink-4); font-style: italic; }

/* Pill-Toggle (z.B. für Mitbewerber Regal / SH) */
.pill-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  gap: 2px;
}
.pill-toggle .pill {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.pill-toggle .pill.on { background: var(--bg-raised); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.pill-toggle .pill:hover:not(.on) { color: var(--ink-2); }
.pill-toggle .pill:focus { outline: none; }
.pill-toggle .pill:focus-visible { outline: 2px solid var(--accent-tint); outline-offset: 2px; }

/* Öffnungszeiten-Editor — Wochenraster wie Feldapp (Vormittag / Nachmittag als Spalten) */
.oh-editor { width: 100%; }
.oh-colheads {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 140px;
  gap: 12px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.oh-colhead {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.oh-grid { display: flex; flex-direction: column; gap: 6px; }
.oh-row {
  display: grid;
  grid-template-columns: 42px 1fr 1fr 140px;
  gap: 12px;
  align-items: center;
}
.oh-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.oh-copy-down {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--ink-3);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast) var(--ease);
}
.oh-copy-down:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-tint); }
.oh-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.oh-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.oh-time {
  flex: 1;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-raised);
  color: var(--ink);
}
.oh-sep { color: var(--ink-4); font-size: 11px; flex-shrink: 0; }
.oh-closed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}
.oh-closed-toggle input { margin: 0; }
/* Zeit-Inputs ausgrauen wenn „Geschlossen" aktiv */
.oh-row.is-closed .oh-slot { opacity: 0.35; pointer-events: none; }

@media (max-width: 640px) {
  /* Mobile: Header ausblenden; pro Tag Label oben, darunter Vormittag + Nachmittag nebeneinander, rechts „Geschlossen" */
  .oh-colheads { display: none; }
  .oh-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
    background: var(--surface-sunken);
    border-radius: var(--r-md);
  }
  .oh-label { font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; }
  .oh-slot-morning::before {
    content: "Vormittag";
    font-size: 10px;
    color: var(--ink-4);
    margin-right: 4px;
    min-width: 56px;
  }
  .oh-slot-afternoon::before {
    content: "Nachmittag";
    font-size: 10px;
    color: var(--ink-4);
    margin-right: 4px;
    min-width: 56px;
  }
  .oh-closed-toggle { justify-content: flex-end; margin-top: 2px; }
}

/* Arbeitszeiten-Editor — wie oh-editor, aber nur ein Time-Slot pro Zeile */
.az-editor { width: 100%; }
.az-grid { display: flex; flex-direction: column; gap: 6px; }
.az-row {
  display: grid;
  grid-template-columns: 90px 1fr 180px;
  gap: 12px;
  align-items: center;
  padding: 6px 2px;
  border-radius: 6px;
}
.az-row.is-closed .oh-slot { opacity: 0.35; pointer-events: none; }
@media (max-width: 640px) {
  .az-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
    background: var(--surface-sunken);
  }
}

/* Modal-Form-Helpers — Section-Labels + Form-Groups (Premium-Look) */
.opt-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.opt-section-label + .opt-section-label { margin-top: 14px; }
.opt-fg { margin-bottom: 14px; }
.opt-fg-label {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}
.opt-input,
.opt-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg-raised);
  color: var(--ink-1);
  font-family: inherit;
}
.opt-input:focus,
.opt-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.opt-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .opt-grid-2 { grid-template-columns: 1fr; } }
.opt-check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: 6px;
}
.opt-check-row input { margin: 0; }
.opt-hint {
  font-size: 11px; color: var(--ink-3);
  background: var(--surface-sunken);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 14px;
  line-height: 1.45;
}

/* Tag-Pills (Mo Di Mi …) – ein Pill-Toggle pro Tag, 7 Spalten */
.day-pill-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
}
.day-pill {
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast) var(--ease);
}
.day-pill.on { background: var(--bg-raised); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.day-pill:hover:not(.on) { color: var(--ink-2); }

/* Klickbare Task-Zeilen in der Offene-Aufgaben-Card.
   Default: sanft eingefärbt mit Akzent links — damit offene Aufgaben sichtbar
   abgesetzt sind und die Liste nicht wie eine Empty-State aussieht. */
.task-row {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin: 0 0 6px 0;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border: none;
  border-left: 3px solid var(--accent);
  text-align: left;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background var(--t-fast) var(--ease);
}
.task-row:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.task-row:last-child { margin-bottom: 0; }

/* Überfällige Aufgaben — überschreibt Akzent-Farbe der Default-Task-Row mit Warn-Rot */
.task-row-overdue {
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-left-color: var(--warn);
}
.task-row-overdue:hover {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
}

/* Kundensuche im Task-Sheet */
.task-cust-dropdown {
  position: absolute;
  left: 0; right: 0; top: 100%;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  margin-top: 4px;
  z-index: 1000;
}
.task-cust-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.task-cust-row:hover,
.task-cust-row:focus { background: color-mix(in srgb, var(--accent) 8%, transparent); outline: none; }
.task-cust-row:last-child { border-bottom: none; }
.task-cust-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.task-cust-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.task-cust-kdnr { font-family: var(--font-mono); color: var(--ink-4); }
.task-cust-empty { padding: 12px; text-align: center; color: var(--ink-3); font-size: 13px; }
.customer-task-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-tint);
  padding: 1px 6px;
  border-radius: var(--r-full);
  margin-left: 4px;
  vertical-align: middle;
}

/* Rhythmus-Bar (Progress zum Besuchsrhythmus) */
.rhythm-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 4px 8px;
  width: 100%; min-width: 0;
}
.rhythm-bar {
  min-width: 30px;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: var(--r-full);
  overflow: hidden;
}
.rhythm-fill { height: 100%; transition: width var(--t-fast) var(--ease); border-radius: var(--r-full); }
.rhythm-fill.rhythm-ok { background: var(--ink-3); }
.rhythm-fill.rhythm-soon { background: var(--amber, #f59e0b); }
.rhythm-fill.rhythm-due { background: var(--warn); }
.rhythm-label { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-3); }
/* "alle 30 Tage" als kleine Sub-Zeile direkt unter Bar+Label */
.rhythm-interval {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--ink-4);
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.rhythm-interval-only { display: block; }
.rhythm-label.rhythm-soon { color: var(--amber, #f59e0b); font-weight: 600; }
.rhythm-label.rhythm-due { color: var(--warn); font-weight: 700; }
.rhythm-empty { font-size: 11px; color: var(--ink-4); }
.rhythm-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-full);
  letter-spacing: 0.01em;
}
.rhythm-chip.rhythm-soon { color: var(--amber, #f59e0b); background: color-mix(in srgb, var(--amber, #f59e0b) 15%, transparent); }
.rhythm-chip.rhythm-due { color: var(--warn); background: var(--warn-tint); }
.order-need-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: var(--r-full);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
}
.order-need-badge.order-need-critical {
  color: #991b1b;
  background: color-mix(in srgb, #ef4444 14%, transparent);
  border-color: color-mix(in srgb, #ef4444 30%, transparent);
}
.order-need-badge.order-need-high {
  color: var(--warn);
}
.customer-order-card {
  margin: 2px 0 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 18%, var(--border));
  border-radius: var(--r-md);
  background: var(--bg-raised);
  overflow: hidden;
}
.customer-order-card > summary::-webkit-details-marker,
.customer-order-card > summary::marker { display: none; content: ''; }
.customer-order-card.is-active {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
}
.customer-order-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  background: color-mix(in srgb, var(--warn) 5%, var(--bg-raised));
}
.customer-order-card.is-active summary {
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-raised));
}
.customer-order-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
}
.customer-order-card-title::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s var(--ease);
}
.customer-order-card[open] .customer-order-card-title::before {
  transform: rotate(90deg);
}
.customer-order-card-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.customer-order-card-meta strong,
.customer-order-card-meta span {
  color: var(--warn);
}
.customer-order-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
}
.customer-order-banner-cases {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.customer-order-banner-case {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--surface-sunken) 70%, transparent);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
}
.customer-order-banner-case:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  text-decoration: none;
}
.customer-order-banner-case span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-order-banner-case strong {
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.customer-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.customer-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.customer-line2 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  min-width: 0;
}
.customer-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 0 1 auto;
}
.customer-kdnr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  flex-shrink: 0;
}
.customer-line1 .customer-task-badge,
.customer-line1 .rhythm-chip { margin-left: auto; }
.customer-line1 .rhythm-chip + .customer-task-badge { margin-left: 0; }
.customer-addr {
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  display: block;
}
.customer-meta-sep {
  color: var(--ink-4);
  padding: 0 4px;
}
/* Legacy-Klassen (fallback) */
.customer-meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.customer-meta-nr { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

.umsatz-betrag { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; display: block; }
.umsatz-date { font-size: 10px; color: var(--ink-4); display: block; font-variant-numeric: tabular-nums; }
.umsatz-trend { display: block; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* Artikel-Matrix-Card */
.am-scroll { overflow-x: auto; max-height: 70vh; }
.am-table { border-collapse: collapse; font-size: 12px; width: 100%; font-variant-numeric: tabular-nums; }
.am-table thead th { position: sticky; top: 0; background: var(--surface-sunken); z-index: 1; padding: 6px 8px; text-align: right; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 11px; }
.am-table th.am-art, .am-table th.am-lbl { text-align: left; }
.am-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.am-table td.am-art { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: left; }
.am-table td.am-lbl { text-align: left; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.am-table td.am-cell { font-size: 11px; }
.am-table td.am-total { font-weight: 700; color: var(--ink-1); border-left: 1px solid var(--border); }
.am-table tr:hover td { background: var(--surface-sunken); }
.am-table th.am-sort { cursor: pointer; user-select: none; }
.am-table th.am-sort:hover { background: var(--surface); color: var(--ink); }
.am-table tfoot tr.am-sum-row td { background: var(--surface-sunken); border-top: 2px solid var(--border); font-weight: 600; }
.am-table tfoot tr.am-sum-row td.am-sum { color: var(--ink); }
.am-table tfoot tr:hover td { background: var(--surface-sunken); }

/* Sales-Analytics-Tabellen */
.sa-table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; table-layout: auto; }
.sa-table thead th { text-align: left; padding: 8px 10px; background: var(--surface-sunken); border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.sa-table th.num, .sa-table td.num { text-align: right; white-space: nowrap; }
.sa-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sa-table tr:hover td { background: var(--surface-sunken); }
.sa-table a { color: var(--ink); text-decoration: none; }
.sa-table a:hover { color: var(--accent); text-decoration: underline; }
.sa-table th.sa-sort { cursor: pointer; user-select: none; }
.sa-table th.sa-sort:hover { background: var(--surface); color: var(--ink); }
.sa-data-warning {
  margin: 8px 0 10px;
  padding: 9px 12px;
  border: 1px solid #f3c7c7;
  border-radius: var(--r-md);
  background: #fff7f7;
  color: #b42318;
  font-size: 12px;
  font-weight: 650;
}
/* Stabile Spaltenbreiten — kein Springen beim Pill-Wechsel.
   Werte als Anteil/min-width pro Spalte; Restspalten bekommen den Rest. */
.sa-table th, .sa-table td { white-space: nowrap; }
.sa-table td:nth-child(2), .sa-table th:nth-child(2) { white-space: normal; } /* Kunde-Spalte darf umbrechen */
.sa-table-name-col { min-width: 220px; }
.sa-table-num-col { width: 110px; min-width: 110px; }
/* Aufklappbare Sektionen in Sales-Analytics */
.sa-collapsible { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.sa-collapsible > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  user-select: none;
}
.sa-collapsible > summary::-webkit-details-marker { display: none; }
.sa-collapsible > summary::before {
  content: '▶'; font-size: 11px; color: var(--ink-3);
  transition: transform .15s ease; flex: 0 0 auto;
}
.sa-collapsible[open] > summary::before { transform: rotate(90deg); }
.sa-collapsible-head { width: 100%; display: flex; align-items: center; gap: 8px; }

/* Sales-Analytics Tab-Navigation — gleicher Pill-Stil wie .sales-src-toggle,
   nur etwas größer/luftiger weil das Hauptnavi-Element. Konsistenz vor Eigenbau. */
.sa-tabs {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface-sunken, #f5f5f5);
  margin-bottom: 18px;
}
.sa-tab-btn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.sa-tab-btn:hover { color: var(--ink); }
.sa-tab-btn.is-active {
  background: var(--bg-raised, #fff);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Inline-Filter-Bar: in jedem Sales-Report unter dem Header sichtbar.
   Dezent abgesetzt, gleicher Button-Stil wie Top-Bar. */
.sa-inline-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-sunken, #f5f5f5);
  border-radius: var(--r-md, 8px);
  border: 1px solid var(--border);
}
.sa-inline-filters .opt-input {
  height: 30px;
  padding: 4px 8px;
  font-size: 13px;
}
.sa-inline-sep { color: var(--ink-4); }
.sa-inline-label { font-size: 12px; color: var(--ink-3); }
.sa-collapsible-actions { margin-left: auto; }

.sa-metric-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px;
  margin: 0 0 12px;
  border: 1px solid color-mix(in srgb, var(--border-strong) 70%, transparent);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--bg-raised) 94%, var(--accent)), var(--surface-sunken));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 58%, transparent), var(--shadow-xs);
}
.sa-metric-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px 2px 8px;
  min-width: 170px;
}
.sa-metric-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.sa-metric-copy strong {
  font-size: 13px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sa-metric-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-raised) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
}
.sa-metric-btn {
  border: 0;
  border-radius: 11px;
  padding: 8px 11px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.sa-metric-btn span {
  display: block;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
}
.sa-metric-btn small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: currentColor;
  opacity: .62;
  text-transform: uppercase;
}
.sa-metric-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}
.sa-metric-btn.is-active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink) 84%, var(--accent)));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--ink) 18%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 18%, transparent);
}
.sa-metric-btn.is-active:active { transform: translateY(1px); }
.sa-metric-value {
  color: var(--ink);
  font-weight: 800;
  background: color-mix(in srgb, var(--accent-tint) 42%, transparent);
}
.sa-metric-mini {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--r-full);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}
@media (max-width: 640px) {
  .sa-metric-panel { align-items: stretch; }
  .sa-metric-copy { min-width: 100%; }
  .sa-metric-switch { width: 100%; grid-template-columns: 1fr; }
  .sa-metric-btn { text-align: center; }
}

/* Mehrjahres-Trend: sortierbare Header + kompakte Multi-Select-Dropdowns */
.sa-trend-table th.sa-trend-yh { cursor: pointer; user-select: none; }
.sa-trend-table th.sa-trend-yh:hover { background: var(--surface-sunken, #f5f5f5); }
.trend-multi {
  display: inline-block;
  position: relative;
}
.trend-multi-summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  user-select: none;
}
.trend-multi-summary::-webkit-details-marker { display: none; }
.trend-multi[open] > .trend-multi-summary {
  border-color: var(--accent, #16a34a);
  color: var(--accent, #16a34a);
}
.trend-multi-options {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  z-index: 100;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 6px;
}
.trend-multi-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--r-sm, 6px);
}
.trend-multi-row:hover { background: var(--surface-sunken, #f5f5f5); }
.trend-multi-row input[type="checkbox"] { cursor: pointer; }

/* Dashboard: Umsatzübersicht (Admin) */
.sales-overview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin: 0 0 18px 0;
}
.sales-overview-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sales-src-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface-sunken, #f5f5f5);
}
.sales-src-btn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.sales-src-btn:hover { color: var(--ink); }
.sales-src-btn.is-active {
  background: var(--bg-raised, #fff);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.sales-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sales-kpi {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.sales-kpi-label { font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.sales-kpi-value { font-size: 20px; font-weight: 700; color: var(--ink); margin: 4px 0; font-variant-numeric: tabular-nums; }
.sales-kpi-trend { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sales-overview-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.sales-mini { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.sales-mini-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 8px; }
.sales-mini-table { width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; border-collapse: collapse; }
.sales-mini-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.sales-mini-table tr:last-child td { border-bottom: none; }
.sales-mini-table td.num { text-align: right; }
.sales-mini-table a { color: var(--ink); text-decoration: none; }
.sales-mini-table a:hover { color: var(--accent); text-decoration: underline; }

/* Desktop: Kunden-Tabelle — EIN gemeinsamer Grid-Container .customer-table,
   Header und Rows nutzen per `grid-template-columns: subgrid` dieselben
   Column-Tracks. Dadurch koennen Header und Datenzellen NIEMALS minimal
   versetzt sein — sie teilen sich physisch dieselben Tracks. */
@media (min-width: 900px) {
  .customer-table {
    display: grid;
    grid-template-columns: 40px minmax(220px, 2fr) 92px 92px 102px 96px minmax(120px, 1fr) 60px 20px;
    column-gap: 18px;
    row-gap: 6px;
  }
  .customer-table-head,
  .customer-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
    column-gap: 18px;
    box-sizing: border-box;
  }
  .customer-row { align-items: center; padding: 10px 14px; min-height: 52px; margin-bottom: 0; }
  .customer-table-head {
    align-items: end;                    /* alle Labels auf Bodenlinie — "KUNDE" (1-zeilig) richtet sich an der 2. Zeile der anderen aus */
    padding: 6px 14px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-4);
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    line-height: 1.3;
  }
  /* Kunde-Header links, Rest zentriert. */
  .customer-table-head > div:nth-child(n+3):nth-child(-n+8) {
    text-align: center;
    justify-self: center;
  }

  /* Pagination-Buttons unten in der Tabelle — spannen volle Breite, mittig */
  .customer-table-pagination {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
  }

  /* Toolbar ueber dem Header — integriert "6 Kunden" + kuenftige Action-Buttons
     optisch in die Tabelle. */
  .customer-table-toolbar {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 14px 10px;
    gap: 10px;
  }
  .customer-table-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.02em;
  }
  /* Datenzellen */
  .customer-col-date,
  .customer-col-umsatz,
  .customer-col-next,
  .customer-col-trend,
  .customer-col-rhythm,
  .customer-col-tasks {
    display: flex; align-items: center; justify-content: center;
    justify-self: stretch;
  }
  .customer-col-trend { flex-direction: column; align-items: center; gap: 0; font-size: 12px; line-height: 1.3; }
  /* "Nächster Termin": Datum oben, "+N weitere" zentriert darunter */
  .customer-col-next { flex-direction: column; gap: 3px; }
  .customer-col-date,
  .customer-col-next { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .customer-col-umsatz { flex-direction: column; align-items: center; gap: 0; }
  .customer-col-tasks { font-size: 12px; color: var(--ink-4); }
  .customer-col-tasks.has-tasks { color: var(--warn); font-weight: 700; }
}

/* Segmented Toggle (Liste / Karte) — an allen Breakpoints verfuegbar */
.seg-toggle {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-radius: calc(var(--r-md, 10px) - 2px);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast, 120ms) ease, color var(--t-fast, 120ms) ease;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.on {
  background: var(--bg-raised);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.seg-btn svg { width: 16px; height: 16px; }

/* Btn-Modifier "is-active" — fuer "Erweitert ●" wenn Filter gesetzt */
.btn.is-active {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

/* ──────────────────────────────────────────────────────────────
   Markiermodus — Action-Bar, Row-Highlighting, Mark-Cell
   ────────────────────────────────────────────────────────────── */
.mark-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: var(--r-md, 10px);
  box-shadow: var(--shadow-md);
  /* Sticky beim Scrollen — bleibt unter dem View-as-Banner und der Top-Header
     der App. 64px ungefaehr Platz fuer Top-Header. */
  position: sticky;
  top: 60px;
  z-index: 50;
}
.mark-bar .btn {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.18);
  color: var(--accent-fg);
}
.mark-bar .btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.28);
}
.mark-bar .btn-primary {
  background: var(--accent-fg);
  color: var(--accent);
  border-color: var(--accent-fg);
  font-weight: 700;
}
.mark-bar .btn-primary:hover {
  background: rgba(255,255,255,0.92);
}
.mark-bar .btn-danger {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}
.mark-bar .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.mark-bar .btn svg { width: 14px; height: 14px; }
.mark-bar-spacer { flex: 1; min-width: 8px; }

/* Hinweis-Zeile unter der Mark-Bar (nur Liste, wenn schon Kunden im Plan sind) */
.mark-bar-legend {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px;
  margin: -6px 0 10px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  font-size: 12px;
  color: var(--ink-3);
}

/* "Nächster Termin"-Datum als kompakter Badge in der Tabellen-Spalte.
   .next-date          → berechneter Tour-Stop (blau, Info-Akzent)
   .next-date-pinned   → vorgemerkt, Plan noch nicht berechnet (amber)
   .next-date-more     → "+N weitere"-Hinweis darunter */
.next-date {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: var(--info-tint);
  color: var(--info);
  border: 1px solid var(--info);
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.next-date-pinned {
  background: var(--amber-tint);
  color: var(--amber);
  border-color: var(--amber);
}
.next-date-more {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  line-height: 1;
}
.mark-bar-legend-note {
  font-weight: 700;
  color: var(--accent);
}

/* Row-Modifier: dezenter Linksrand fuer Kunden im Plan (immer, nicht nur Mark-Mode) */
.customer-row.is-in-tour {
  border-left: 3px solid var(--info);
  padding-left: 11px;
}

/* "Naechster Termin"-Card — vereinte Termin-Liste mit Aktionen */
.termin-list { display: flex; flex-direction: column; gap: 2px; }
.termin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.termin-row:last-child { border-bottom: none; }
.termin-row-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 42px;
}
.termin-row-label {
  flex: 1;
  color: var(--ink-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.termin-row-user {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.termin-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn-sm {
  width: 28px; height: 28px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn-sm svg { width: 14px; height: 14px; }
.mark-bar-count {
  font-size: 13px;
  color: var(--accent-fg);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.mark-bar-count strong { font-size: 15px; font-weight: 800; }
.mark-bar-of { opacity: 0.78; font-weight: 500; }
.mark-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; align-items: center; }

/* Mobile: Counter eigene Zeile oben, Buttons in einer Reihe darunter.
   Spart vertikalen Platz und macht die Karte sichtbar. */
@media (max-width: 720px) {
  .mark-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .mark-bar-count {
    text-align: center;
    font-size: 12px;
  }
  .mark-bar-count strong { font-size: 14px; }
  .mark-bar-actions {
    flex: 0;
    flex-wrap: nowrap;
    justify-content: space-between;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mark-bar-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 7px 6px;
    font-size: 12px;
    white-space: nowrap;
  }
  /* Auf Mobile die Icons IN den Buttons weglassen — Text allein passt
     besser in die schmalen Boxen, alle 4 Buttons werden sichtbar. */
  .mark-bar-actions .btn svg { display: none; }
  /* Listen-only Buttons (Alle / Abwählen / Löschen) auf Mobile ausblenden —
     im Markiermodus auf dem Smartphone nutzt man eh die Wisch-Aktionen. */
  .mark-bar-spacer { display: none; }
}

/* Markierte Row */
.customer-row.is-marked {
  background: var(--accent-tint);
  border-color: var(--accent);
}
.customer-row.is-marked .customer-name { color: var(--accent); }

/* Icon-Slot im Markiermodus: Checkbox-ish — grauer Rahmen, bei is-marked
   den Haken (via Icons.check()). */
.customer-row .mark-cell {
  background: var(--bg-raised);
  border: 2px solid var(--border-strong);
  color: var(--accent-fg);
  width: 28px; height: 28px;
  border-radius: var(--r-sm, 6px);
}
.customer-row.is-marked .mark-cell {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.customer-row.is-marked .mark-cell svg { width: 18px; height: 18px; stroke-width: 3; }

/* Im Markiermodus Hover/Aktiv auch auf markierten Rows sichtbar halten */
.customer-table.is-mark-mode .customer-row:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-raised));
}
.customer-table.is-mark-mode .customer-row.is-marked:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-raised));
}

/* ──────────────────────────────────────────────────────────────
   Bulk-Edit Chooser — 3-Spalten-Layout (Vormerkung / Besuche / Weitere)
   ────────────────────────────────────────────────────────────── */
.bulk-chooser {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.4fr;
  gap: 14px;
}
.bulk-chooser-col {
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
}
.bulk-chooser-title {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.bulk-chooser-count {
  font-size: 14px; color: var(--ink);
  margin-top: 2px;
}
.bulk-chooser-count strong { font-size: 16px; font-weight: 800; }
.bulk-chooser-sub {
  font-size: 12px; color: var(--ink-3);
  margin-bottom: 8px;
}
.bulk-chooser-action {
  display: block;
  text-align: left;
  padding: 7px 8px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm, 6px);
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast, 120ms) ease;
}
.bulk-chooser-action:hover {
  background: var(--accent-tint);
}
.bulk-chooser-action.is-disabled {
  color: var(--ink-4);
  cursor: not-allowed;
  font-weight: 500;
}
.bulk-chooser-action.is-disabled em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 400;
  margin-left: 4px;
}

/* Gespeicherte-Suchen-Chips (im Erweitert-Suche-Modal oben) */
.saved-search-chip {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--accent);
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent-tint);
}
.saved-search-load {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}
.saved-search-load:hover { background: rgba(0,0,0,0.04); }
.saved-search-del {
  background: transparent;
  border: none;
  border-left: 1px solid var(--accent);
  padding: 0 6px;
  cursor: pointer;
  color: var(--accent);
  font-family: inherit;
  display: inline-flex; align-items: center;
}
.saved-search-del:hover { background: rgba(0,0,0,0.06); }
.saved-search-del svg { width: 12px; height: 12px; }

/* Eigenes Modal "Gespeicherte Suchen" — Liste */
.saved-searches-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  overflow: hidden;
}
.saved-search-row {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
}
.saved-search-row:last-child { border-bottom: none; }
.saved-search-row:hover { background: var(--surface-sunken); }
.saved-search-row-main {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
}
.saved-search-row-name {
  font-size: 14px; font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.saved-search-row-summary {
  font-size: 12px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saved-search-row .icon-btn-sm {
  margin-right: 10px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .bulk-chooser { grid-template-columns: 1fr; }
}

@media (max-width: 899px) {
  .customer-order-card summary,
  .customer-order-card-body {
    align-items: flex-start;
    flex-direction: column;
  }
  .customer-order-banner-cases {
    justify-content: flex-start;
  }
  .customer-table-head { display: none; }
  .customer-col-date,
  .customer-col-umsatz,
  .customer-col-next,
  .customer-col-trend,
  .customer-col-rhythm,
  .customer-col-tasks { display: none; }
  .customer-table-pagination {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
  }
}

/* Klickhinweis-Pfeil: immer ganz rechts (mobil via margin-auto, desktop via Grid-Column) */
.customer-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-3);
  opacity: 0.85;
  margin-left: auto;
  transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.customer-chev svg { width: 18px; height: 18px; stroke-width: 2.25; }
.customer-row:hover .customer-chev { color: var(--accent); transform: translateX(2px); opacity: 1; }
@media (min-width: 900px) {
  .customer-chev { margin-left: 0; grid-column: -1; justify-self: end; }
}
.customer-addr-missing { color: var(--ink-4); font-style: italic; font-size: 11px; }

/* ── Login ────────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}
.login-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo svg { width: 22px; height: 22px; }
.login-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
  color: var(--ink);
}
.login-sub {
  font-size: 14px;
  color: var(--ink-3);
  margin: 0 0 24px;
}
.login-field { margin-bottom: 14px; }
.login-field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.login-submit { margin-top: 6px; }
.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--warn);
  text-align: center;
  min-height: 18px;
}
.login-hint {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-4);
  text-align: center;
}
.login-hint strong { color: var(--ink-3); font-weight: 600; }

/* ── Menu Screen ──────────────────────────────────────── */
.menu-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
}
.menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.menu-user-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.menu-user-role { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.menu-group {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  width: 100%;
  text-align: left;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  min-height: var(--tap);
  transition: background var(--t-fast) var(--ease);
}
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: var(--surface-sunken); }
.menu-row svg.icon-lead { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.menu-row svg.icon-chev { width: 16px; height: 16px; color: var(--ink-4); flex-shrink: 0; }
.menu-row-label { flex: 1; font-size: 15px; font-weight: 500; }
.menu-row-value { font-size: 13px; color: var(--ink-3); }

/* Trenner innerhalb einer .menu-group — z.B. zwischen operativen und Admin-Konfig-Punkten */
.menu-subdivider {
  height: 1px;
  background: var(--border);
  margin: 4px 16px;
}

.theme-toggle {
  display: flex;
  background: var(--surface-sunken);
  padding: 3px;
  border-radius: var(--r-md);
  gap: 2px;
}
.theme-toggle-opt {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 7px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--t-fast) var(--ease);
}
.theme-toggle-opt svg { width: 14px; height: 14px; }
.theme-toggle-opt.active {
  background: var(--bg-raised);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ── Globaler Datumswechsler (Dashboard oben) ─────────── */
.date-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.date-bar input[type="date"] {
  padding: 7px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  min-height: 36px;
}

/* ── Kunde-360° Sektions-Card (collapsible, mit premium Header) ──── */
.k360-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.k360-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  user-select: none;
  background: linear-gradient(180deg, var(--bg-raised) 0%, color-mix(in srgb, var(--surface-sunken) 60%, var(--bg-raised)) 100%);
  transition: background 0.18s var(--ease);
}
.k360-card[open] > summary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-tint) 40%, var(--bg-raised)) 0%, var(--bg-raised) 100%);
  border-bottom: 1px solid var(--border);
}
.k360-card > summary:hover {
  background: linear-gradient(180deg, var(--bg-raised) 0%, var(--surface-sunken) 100%);
}
.k360-card > summary::-webkit-details-marker,
.k360-card > summary::marker { display: none; content: ''; }
.k360-card > summary .k360-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.k360-card > summary .k360-title::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s var(--ease);
}
.k360-card[open] > summary .k360-title::before { transform: rotate(90deg); }
.k360-card > summary .k360-meta {
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.k360-card .k360-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--accent-tint);
  color: var(--accent);
}
.k360-card .k360-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--ink-3);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  padding: 0;
  flex-shrink: 0;
}
.k360-card .k360-edit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}
.k360-card .k360-edit-btn svg { width: 14px; height: 14px; stroke-width: 2; }
.k360-card .k360-body {
  padding: 14px 16px 16px;
}
.k360-card[open] .k360-body {
  animation: k360-open 0.2s var(--ease);
}
@keyframes k360-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quick-Actions: Primary-Reihe — immer eine Zeile, Spaltenanzahl variabel (3 oder 4) */
.qa-primary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.qa-primary[data-count="4"] { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  /* 3 Buttons (Admin/Manager): alle in einer Zeile, Icon über Label */
  .qa-primary { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .qa-primary .quick-action.qa-accent {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 10px 4px;
    min-height: 62px;
  }
  .qa-primary .quick-action.qa-accent svg { width: 18px; height: 18px; }
  .qa-primary .quick-action.qa-accent .quick-action-label { font-size: 11px; line-height: 1.2; }

  /* 4 Buttons (AD): 2×2, Icon + Label mittig nebeneinander */
  .qa-primary[data-count="4"] { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .qa-primary[data-count="4"] .quick-action.qa-accent {
    flex-direction: row;
    gap: 8px;
    padding: 10px 8px;
    min-height: 48px;
  }
  .qa-primary[data-count="4"] .quick-action.qa-accent .quick-action-label { font-size: 13px; }
}
.quick-action.qa-accent {
  background: var(--accent-tint);
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  min-height: 86px;
}
.quick-action.qa-accent svg { color: var(--accent); width: 22px; height: 22px; }
.quick-action.qa-accent .quick-action-label { color: var(--accent); font-weight: 700; font-size: 12px; }
.quick-action.qa-accent:active { filter: brightness(0.96); }

.qa-more { margin-bottom: 24px; }
.qa-more summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
  padding: 8px 4px;
  user-select: none;
}
.qa-more summary::-webkit-details-marker,
.qa-more summary::marker { display: none; content: ''; }
.qa-more summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s var(--ease);
}
.qa-more[open] summary::before { transform: rotate(90deg); }
.qa-more .quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  margin-top: 8px;
}

/* ── Globale Suche (Overlay) ──────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(40px, var(--safe-top)) 16px 20px;
}
.search-panel {
  width: 100%;
  max-width: 640px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.search-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-panel-head input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  padding: 6px 0;
}
.search-panel-head svg { color: var(--ink-3); width: 18px; height: 18px; }
.search-panel-hint {
  font-size: 10px;
  color: var(--ink-4);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
}
.search-results {
  overflow-y: auto;
  flex: 1;
}
.search-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 12px 16px 6px;
}
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--ink);
  cursor: pointer;
}
.search-result:first-child { border-top: none; }
.search-result:hover,
.search-result:focus { background: var(--surface-sunken); outline: none; }
.search-result-title { font-size: 14px; font-weight: 600; }
.search-result-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.search-empty { padding: 40px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* Sync-Status-Zeile unter Kundenname */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--surface-sunken);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--ink-3);
  border: 1px solid var(--border);
}
.sync-status svg { width: 11px; height: 11px; color: var(--ink-4); }
.sync-status button {
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
}
.kunde-head-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.5;
}
.kunde-head-meta strong { color: var(--ink-2); font-weight: 600; }

/* Warnkarte für vergangene Touren mit offenen Stopps */
.tour-past-warn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--amber) 12%, var(--bg-raised));
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
}
.tour-past-warn svg { width: 20px; height: 20px; color: var(--amber); flex-shrink: 0; margin-top: 2px; }

/* ──────────────────────────────────────────────────────────────
   Meine Tour (/tour/<datum>) — Feldapp-Style Tagesplan mit
   Strecken/Zeiten zwischen den Stopps.
   ────────────────────────────────────────────────────────────── */
.tour-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 14px;
}
.tour-summary-tile {
  background: var(--surface-sunken); border-radius: var(--r-md);
  padding: 10px 12px; min-width: 0;
}
.tour-summary-label {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px;
}
.tour-summary-value {
  font-size: 18px; font-weight: 700; color: var(--ink);
  line-height: 1.1; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tour-summary-unit { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }

@media (max-width: 700px) {
  .tour-summary { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tour-summary-tile { padding: 8px 10px; }
  .tour-summary-value { font-size: 16px; }
}

.tour-row-headline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0;
}
.tour-row-headline .tour-row-name { flex: 0 1 auto; min-width: 0; margin-bottom: 0; }
.tour-row-badges {
  display: flex; gap: 4px; flex-wrap: nowrap;
  overflow: hidden; min-width: 0; flex: 0 1 auto;
}
.tour-row-badges > .tour-badge { flex: 0 0 auto; }
@media (max-width: 600px) {
  .tour-row-headline { gap: 4px 6px; }
  .tour-row-badges { width: 100%; }
}
.tour-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 999px; line-height: 1.5; white-space: nowrap;
  background: var(--surface-sunken); color: var(--ink-3); border: 1px solid var(--border);
}
.tour-badge-fixed { background: rgba(26,75,140,0.10); color: #1a4b8c; border-color: rgba(26,75,140,0.20); }
.tour-badge-due   { background: rgba(192,57,43,0.10); color: #c0392b; border-color: rgba(192,57,43,0.20); }
.tour-badge-appt  { background: rgba(217,119,6,0.10); color: var(--amber); border-color: rgba(217,119,6,0.20); }
.tour-badge-type  { background: var(--surface); color: var(--ink-2); }
.tour-badge-done  { background: rgba(22,163,74,0.12); color: #16a34a; border-color: rgba(22,163,74,0.30); font-weight: 700; }

.tour-row-rhythm {
  font-size: 11px; color: var(--ink-3); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.tour-footer-actions {
  margin-top: 16px; display: flex; gap: 8px;
}
.tour-footer-actions .btn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-start-banner,
.tour-run-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--ink);
}
.tour-start-banner {
  border-color: rgba(192, 57, 43, 0.28);
  background: rgba(192, 57, 43, 0.055);
}
.tour-start-banner span,
.tour-run-banner span {
  color: var(--ink-3);
  font-size: 13px;
}

.tour-list { display: flex; flex-direction: column; }

.tour-row {
  display: grid;
  grid-template-columns: 80px minmax(150px, 1fr) 100px 90px 60px 120px;
  gap: 12px; padding: 12px 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
/* Header-Zeile fuer Tour-Liste — analog zur Kundenliste */
.tour-list-head {
  display: grid;
  grid-template-columns: 80px minmax(150px, 1fr) 100px 90px 60px 120px;
  gap: 12px;
  padding: 8px 14px 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-4); line-height: 1.3;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.tour-list-head > div:nth-child(n+3):nth-child(-n+5) { text-align: center; }
/* Stop-Zellen */
.tour-row-umsatz, .tour-row-trend, .tour-row-tasks {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums;
  text-align: center;
}
.tour-row-umsatz .umsatz-amt { font-weight: 600; }
.tour-row-umsatz .umsatz-dt { font-size: 10px; color: var(--ink-4); }
.tour-row-tasks.has-tasks { color: var(--warn,#c0392b); font-weight: 700; }
/* Anchor- und skipped-Zeilen: kein Spalten-Layout, body+actions full-width */
.tour-row-anchor .tour-row-body,
.tour-row-skipped .tour-row-body,
.tour-row-suggest .tour-row-body { grid-column: 2 / -2; }

/* Mobile: Spalten-Layout zurueck auf einfaches 3-Spalten-Grid */
@media (max-width: 899px) {
  .tour-list-head { display: none; }
  .tour-row { grid-template-columns: 80px 1fr auto; }
  .tour-row-umsatz, .tour-row-trend, .tour-row-tasks { display: none; }
}
.tour-row + .tour-row { margin-top: 4px; }
.tour-row-stop { cursor: pointer; transition: background .12s; }
.tour-row-stop:hover { background: var(--surface-sunken); }
.tour-row-stop.is-done {
  background: rgba(22,163,74,0.05);
  border-left: 3px solid #16a34a;
}
.tour-row-stop.is-done .tour-row-name {
  text-decoration: line-through;
  color: var(--ink-3);
}
.tour-row-stop.is-done .tour-row-time,
.tour-row-stop.is-done .tour-row-meta,
.tour-row-stop.is-done .tour-row-umsatz,
.tour-row-stop.is-done .tour-row-trend,
.tour-row-stop.is-done .tour-row-tasks { opacity: .55; }
.tour-row-anchor { background: var(--surface-sunken); }
.tour-row-clickable { cursor: pointer; transition: background .12s; }
.tour-row-clickable:hover { background: var(--surface); }
.tour-row-anchor.tour-row-clickable:hover { background: var(--surface); }
.tour-row-skipped { background: var(--surface); border-color: rgba(192,57,43,0.15); }
.tour-row-skipped:hover { background: rgba(192,57,43,0.04); }
.tour-row-suggest { background: var(--surface); border-color: rgba(39,174,96,0.20); }
.tour-row-suggest:hover { background: rgba(39,174,96,0.05); }

/* Kunde-Hinzufuegen Modal: Liste */
.mt-add-list {
  max-height: 50vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-md);
  margin-top: 4px;
}
.mt-add-row {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.mt-add-row:last-child { border-bottom: none; }
.mt-add-row:hover { background: var(--surface-sunken); }
.mt-add-row-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.mt-add-row-meta {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* Vollbild-Tour-Karte (/tour/<u>/<d>/karte) — Karte fuellt verfuegbare Hoehe. */
.screen-tour-map {
  display: flex; flex-direction: column;
  height: 100vh; min-height: 0; overflow: hidden;
}
.screen-tour-map .top-header-detail { flex-shrink: 0; }
.screen-tour-map-body {
  position: relative; flex: 1 1 auto; min-height: 0;
}

/* Tag-Tabs ueber der Wochenkarte */
.bp-map-tabs {
  display: flex; gap: 6px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
}
.bp-map-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 2px solid var(--border);
  border-radius: var(--r-md); background: #fff; cursor: pointer;
  font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap;
  transition: filter .12s, transform .12s;
}
.bp-map-tab:hover { filter: brightness(0.96); }
.bp-map-tab:active { transform: scale(0.97); }
.bp-map-tab-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.bp-map-tab-toggle {
  background: var(--surface-sunken); color: var(--ink-2);
  border-color: var(--border); padding: 6px 10px;
}
.bp-map-tab-toggle.is-active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.bp-map-tab-toggle svg { width: 16px; height: 16px; }

/* ──────────────────────────────────────────────────────────────
   Besuchsplan — Wochen-Hub mit Tag-Karten
   ────────────────────────────────────────────────────────────── */
.bp-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.bp-week-nav {
  display: flex; align-items: center; gap: 8px;
}
.bp-week-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 140px; flex: 0 0 auto; text-align: center;
}
.bp-week-kw { font-weight: 700; font-size: 15px; color: var(--ink); line-height: 1.2; }
.bp-week-range { font-size: 12px; color: var(--ink-3); }
.bp-today-btn { margin-left: 4px; }

.bp-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.bp-actions .btn { white-space: nowrap; }

@media (max-width: 720px) {
  .bp-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .bp-week-nav { justify-content: center; }
  .bp-actions { width: 100%; }
  /* Plan aktualisieren + Planungsparameter teilen den Hauptraum, "Karte" ist kompakt. */
  .bp-actions .btn-primary,
  .bp-actions .btn-secondary:not(.bp-btn-compact) {
    flex: 1 1 0; min-width: 0;
    overflow: hidden; text-overflow: ellipsis;
  }
  .bp-btn-compact { flex: 0 0 auto; padding-left: 12px !important; padding-right: 12px !important; }
  /* Auf engen Screens Icons ausblenden, Text bleibt. */
  .bp-actions .btn svg { display: none; }
  .bp-actions .btn { padding-left: 8px; padding-right: 8px; font-size: 13px; }
  /* Excel-Export auf Mobile ausblenden — kann dort eh nicht geoeffnet werden. */
  .bp-btn-export { display: none !important; }
}

.bp-plan-range-hint {
  font-size: 13px; color: var(--ink-2); margin-bottom: 14px;
  padding: 10px 14px; background: var(--surface-sunken); border-radius: var(--r-md);
}
.bp-plan-range-hint .btn-link {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-weight: 600; padding: 0 4px; min-height: auto; font-size: 13px;
}

.bp-day-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
}
@media (max-width: 900px) {
  .bp-day-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .bp-day-grid { grid-template-columns: 1fr; }
}

.bp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer; transition: background .12s, border-color .12s, transform .12s;
  text-align: left; min-width: 0;
}
.bp-card:hover { background: var(--surface-sunken); border-color: var(--ink-4); }
.bp-card:active { transform: scale(0.99); }
.bp-card.is-today { border-color: var(--accent); border-width: 2px; }

.bp-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.bp-card-day { font-weight: 700; font-size: 14px; color: var(--ink); }
.bp-card-today {
  background: var(--accent); color: var(--accent-fg);
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.bp-card-stops { font-size: 14px; color: var(--ink-2); }
.bp-card-stops strong { font-size: 18px; font-weight: 700; color: var(--ink); margin-right: 4px; }
.bp-card-stats {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.bp-card-util { display: flex; flex-direction: column; gap: 4px; }
.bp-card-util-bar {
  height: 6px; background: var(--surface-sunken); border-radius: 3px; overflow: hidden;
}
.bp-card-util-fill {
  height: 100%; background: var(--accent);
  transition: width .25s ease;
}
.bp-card-util-label { font-size: 11px; color: var(--ink-3); }
.bp-card-skipped {
  font-size: 11px; color: var(--warn, #c0392b); font-weight: 600;
}
.bp-card-empty {
  background: var(--surface-sunken);
  border-style: dashed;
}
.bp-card-empty-msg {
  font-size: 13px; color: var(--ink-3); padding: 10px 0;
}

.field-hint {
  font-size: 11px; color: var(--ink-3); margin-top: 4px; line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────────
   Optionen-View — CRM-Premium-Look (Section-Label + Card mit Items)
   ────────────────────────────────────────────────────────────── */
.opt-user-line {
  font-size: 14px; color: var(--ink-3);
  margin: -8px 0 16px;
}
.opt-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(3, 1fr);
}
.opt-grid-user {
  grid-template-columns: 1fr 1fr;
  max-width: 720px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .opt-grid, .opt-grid-user { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .opt-grid, .opt-grid-user { grid-template-columns: 1fr; }
}
.opt-section { display: flex; flex-direction: column; gap: 6px; }
.opt-group {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.opt-row {
  display: block; width: 100%;
  padding: 13px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--ink); text-align: left;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.opt-row:last-child { border-bottom: none; }
.opt-row:hover { background: var(--surface-sunken); }
.opt-row:active { background: var(--surface-sunken); }
.opt-row-disabled {
  color: var(--ink-4); cursor: default;
}
.opt-row-disabled:hover { background: transparent; }

/* Abwesenheits-Modal — 2-Reihen-Pill-Layout (3 + 2).
   Wie .pill-toggle .pill, aber jede Reihe ist ein eigener Pill-Toggle-Bar. */
.abs-type-row {
  display: grid; gap: 4px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  margin-top: 6px;
}
.abs-type-row-3 { grid-template-columns: repeat(3, 1fr); }
.abs-type-row-2 { grid-template-columns: repeat(2, 1fr); }
.abs-type-row .pill {
  padding: 5px 14px; font-size: 12px; font-weight: 600;
  color: var(--ink-3); background: transparent; border: none;
  border-radius: var(--r-full); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  text-align: center; white-space: nowrap;
}
.abs-type-row .pill.on {
  background: var(--bg-raised); color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.abs-type-row .pill:hover:not(.on) { color: var(--ink-2); }
.abs-type-row .pill:focus { outline: none; }
.abs-type-row .pill:focus-visible { outline: 2px solid var(--accent-tint); outline-offset: 2px; }
@media (max-width: 480px) {
  .abs-type-row-3 { grid-template-columns: 1fr 1fr; }
  .abs-type-row-3 .pill:first-child { grid-column: 1 / -1; }
}
.tour-row-drop-reason {
  margin-left: auto;
  color: var(--warn, #c0392b);
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 0 1 auto; min-width: 0; max-width: 60%;
}
@media (max-width: 600px) {
  .tour-row-drop-reason { max-width: 100%; flex-basis: 100%; margin-left: 0; }
}

/* Modal-Footer mit drei gleich breiten Buttons in einer Reihe — auch mobile.
   Hoehere Spezifitaet via .modal-footer.modal-footer-3, damit globale
   .modal-footer-Regeln (flex/wrap/btn flex:0) ueberschrieben werden. */
.modal-footer.modal-footer-3,
.modal-footer-3 {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr !important;
  gap: 8px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  justify-content: stretch !important;
  flex-wrap: nowrap !important;
}
.modal-footer.modal-footer-3 .btn,
.modal-footer-3 .btn {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .modal-footer.modal-footer-3,
  .modal-footer-3 { gap: 6px; }
  .modal-footer.modal-footer-3 .btn,
  .modal-footer-3 .btn { padding-left: 8px !important; padding-right: 8px !important; font-size: 13px; }
}
.tour-row-time {
  font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.4;
  white-space: nowrap;
}
.tour-row-arrival { color: var(--accent); }
.tour-row-departure { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.tour-row-duration { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.tour-row-body { min-width: 0; }
.tour-row-name { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; word-break: break-word; }
.tour-row-meta { font-size: 12px; color: var(--ink-3); word-break: break-word; }
.tour-row-actions { display: flex; gap: 4px; align-self: center; justify-content: flex-end; }

.tour-leg {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 14px; margin: 2px 0;
  font-size: 12px; color: var(--ink-3);
}
.tour-leg-line {
  width: 80px; height: 1px; background: var(--border);
  margin-right: 4px;
}
.tour-leg-text { font-weight: 500; }

@media (max-width: 600px) {
  .tour-row { grid-template-columns: 64px 1fr auto; gap: 8px; padding: 10px 12px; }
  .tour-row-time { font-size: 12px; }
  .tour-leg-line { width: 50px; }
}

/* Color-Preset-Picker (für Eintragstypen & Tag-Gruppen) */
.color-preset-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.color-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.color-preset span:first-child {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
}
.color-preset-label { font-size: 10px; color: var(--ink-3); letter-spacing: 0.02em; }
.color-preset:hover { border-color: var(--ink-3); }
.color-preset.on { border-color: var(--accent); background: var(--accent-tint); }
.color-preset.on .color-preset-label { color: var(--accent); font-weight: 600; }

/* Emoji-Picker (Bottom-Sheet, nach Kategorien) */
.emoji-picker { max-height: 60vh; overflow-y: auto; }
.emoji-picker #emoji-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  background: var(--bg-raised);
  color: var(--ink);
}
.emoji-cat { margin-bottom: 14px; }
.emoji-cat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  margin: 8px 2px 6px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-cell {
  font-size: 22px;
  padding: 6px 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  line-height: 1;
}
.emoji-cell:hover { background: var(--surface-sunken); }

/* Tag-Button mit dynamischer Farbe (aus Gruppe oder eigenem Override) */
.tag-btn-colored {
  border-left: 3px solid var(--tag-color, var(--border));
}
.tag-btn-colored.active {
  background: color-mix(in srgb, var(--tag-color, var(--accent)) 18%, transparent);
  color: var(--tag-color, var(--accent));
  border-color: var(--tag-color, var(--accent));
}
.kunde-head-kdnr {
  font-family: var(--font-mono);
  font-size: 0.5em;
  font-weight: 500;
  color: var(--ink-4);
  letter-spacing: 0.01em;
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .kunde-head-kdnr { display: inline-block; font-size: 11px; margin-left: 0; margin-top: 2px; }
}

/* Desktop: alle k360-cards in 3-Spalten-Grid (kompakter, weniger Scrollen) */
@media (min-width: 900px) {
  .k360-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  .k360-grid > .k360-card { margin-bottom: 0; min-width: 0; }
  /* Kompakteres Card-Padding auf Desktop */
  .k360-card > summary { padding: 12px 14px; }
  .k360-card .k360-body { padding: 12px 14px 14px; }
}
.k360-card { min-width: 0; }
.k360-card .info-grid {
  grid-template-columns: 112px 1fr;
  gap: 8px 12px;
  font-size: 13px;
  word-break: break-word;
}
.k360-card .info-grid .info-label,
.k360-card .info-grid .info-label-erp {
  font-size: 12px;
  line-height: 1.3;
}
.k360-card .info-grid .info-value {
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
}

/* ── Einklappbare Sektion (details/summary) ───────────── */
.collapsible { margin-bottom: 24px; }
.collapsible summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 4px 10px;
  gap: 12px;
  user-select: none;
}
.collapsible summary::-webkit-details-marker,
.collapsible summary::marker { display: none; content: ''; }
.collapsible summary .section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.collapsible summary .section-title::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s var(--ease);
  transform-origin: 30% 50%;
}
.collapsible[open] summary .section-title::before {
  transform: rotate(90deg);
}
.collapsible summary .section-meta { font-size: 12px; color: var(--ink-3); }

/* ── Dashboard (Innendienst) ──────────────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.dash-kpi {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  color: var(--ink);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  text-align: left;
  width: 100%;
}
.dash-kpi:active { background: var(--surface-sunken); }
.dash-kpi.kpi-urgent {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 30%, transparent);
}
.dash-kpi.kpi-warn { border-color: color-mix(in srgb, var(--amber) 50%, transparent); }
.dash-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.dash-kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
}
.dash-kpi.kpi-urgent .dash-kpi-value { color: var(--warn); }
.dash-kpi.kpi-warn .dash-kpi-value { color: var(--amber); }
.dash-kpi-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* Activity-List */
/* ──────────────────────────────────────────────────────────────
   Dashboard — KPI-Strip + Quick-Actions (Admin/Manager)
   ────────────────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0 14px;
}
.kpi-card {
  display: flex; flex-direction: column;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  cursor: pointer;
  text-align: left;
  transition: all var(--t-fast) var(--ease);
  font-family: inherit;
}
.kpi-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.kpi-card.kpi-warn { border-color: #e67e22; background: #fff8f1; }
.kpi-card.kpi-warn:hover { border-color: #d35400; }
.kpi-value {
  font-size: 26px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-card.kpi-warn .kpi-value { color: #d35400; }
.kpi-of { font-size: 16px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.kpi-label {
  font-size: 11px; font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 4px;
}
.kpi-sub {
  font-size: 11px; color: var(--ink-3); margin-top: 2px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}
.quick-action {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 18px;
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--r-full);
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all var(--t-fast) var(--ease);
  font-family: inherit;
}
.quick-action:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-raised));
  border-color: var(--accent);
}
.quick-action:active { filter: brightness(0.95); }

/* ──────────────────────────────────────────────────────────────
   Team-Karte — User-Filter-Pills + leerer Zustand
   ────────────────────────────────────────────────────────────── */
.tm-datebar {
  padding: 10px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.tm-datebar .date-bar { margin: 0; }

.tm-userbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.tm-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--t-fast) var(--ease);
}
.tm-user-pill:hover { filter: brightness(0.96); }
.tm-pill-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tm-pill-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 2px;
}
.tm-user-pill:not(.is-active) .tm-pill-count {
  background: var(--surface-sunken);
  color: var(--ink-3);
}
.tm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 5;
  pointer-events: none;
}

/* Date-Bar: custom Display über nativem date-input — zeigt z.B. "So, 26.04.26" */
.date-bar-input {
  position: relative;
  display: inline-block;
}
.date-bar-input input[type="date"] {
  /* nativer Text wird unsichtbar — Display-Span übernimmt die Anzeige */
  color: transparent;
  caret-color: transparent;
  font-family: inherit;
  font-size: 14px;
}
.date-bar-input input[type="date"]::-webkit-datetime-edit { color: transparent; }
.date-bar-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 12px;
  pointer-events: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activity-list {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.activity-item {
  display: flex;
  width: 100%;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  text-align: left;
  color: var(--ink);
  transition: background var(--t-fast) var(--ease);
  box-sizing: border-box;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:active { background: var(--surface-sunken); }

.activity-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.activity-author { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.activity-arrow { color: var(--ink-4); font-size: 12px; }
.activity-customer { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.activity-time {
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.activity-text {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Desktop-Anpassungen (≥ 900px) ────────────────────── */
@media (min-width: 900px) {
  .screen-body {
    padding: 28px 40px;
  }
  .top-header, .top-header-detail {
    padding-left: 40px;
    padding-right: 40px;
  }
  .dash-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  .dash-kpi-value { font-size: 36px; }
  .hero-name { font-size: 30px; }
  .kunde-name { font-size: 30px; }
  .header-title-l { font-size: 34px; }
  /* Auf Desktop: 3-Spalten-Layout für Dashboard */
  .dash-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .dash-layout > section { min-width: 0; }
  .kpi-strip { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .quick-actions { gap: 10px; }
  .quick-action { flex: 1 1 auto; }
  /* Kunde-Detail: zwei Spalten (Info links, Tabs rechts) */
  .kunde-grid {
    display: grid;
    grid-template-columns: minmax(320px, 440px) 1fr;
    gap: 28px;
    align-items: start;
  }
  .kunde-grid > div { min-width: 0; }

  /* Heute-Screen: Hero + Tour links, Stop-Liste rechts */
  .heute-grid {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) 1.1fr;
    gap: 28px;
    align-items: start;
  }
  .heute-grid > div { min-width: 0; }

  /* Sticky Left-Column: bleibt beim Scrollen im Viewport auf langen Tab-Inhalten */
  .kunde-grid > div:first-child,
  .heute-grid > div:first-child {
    position: sticky;
    top: 88px;
  }
}

/* ERP-Feld-Markierung */
.info-label-erp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.info-label-erp svg {
  width: 11px;
  height: 11px;
  color: var(--ink-4);
  flex-shrink: 0;
}
.erp-hint {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}
.erp-hint svg { width: 11px; height: 11px; color: var(--ink-3); flex-shrink: 0; }

.field-label-erp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.field-label-erp svg { width: 11px; height: 11px; color: var(--ink-4); }
.form-section-erp .input {
  background: var(--surface-sunken);
  color: var(--ink-2);
}

/* Größere Desktop-Screens: Kacheln nicht unnatürlich breit */
@media (min-width: 1400px) {
  .screen-body { padding: 28px 56px; }
}

/* ── Karte / Platzhalter ──────────────────────────────── */
.placeholder-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 48px 24px;
  gap: 10px;
  color: var(--ink-3);
  text-align: center;
}
.placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  background: var(--surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.placeholder-icon svg { width: 28px; height: 28px; }
.placeholder-title { font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.placeholder-sub { font-size: 13px; max-width: 300px; line-height: 1.5; }

/* ──────────────────────────────────────────────────────────────
   Modal (Feldapp-kompatibel, mit CRM-Design-Tokens)
   ────────────────────────────────────────────────────────────── */
.modal-overlay {
  /* z-index ueber Sheets (9000), damit Modals (z.B. Emoji-Picker) ueber einem
     offenen Edit-Sheet angezeigt werden koennen. Map-Popup liegt darueber (9800). */
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: modal-fade-in var(--t-fast, 120ms) ease-out;
}
.modal {
  background: var(--bg-raised);
  color: var(--ink);
  border-radius: var(--r-md, 10px);
  /* Feste Breite. Scrollt wird *innen* in .modal-body — dadurch bleibt
     die Modal-Breite absolut stabil, egal wie hoch der Content ist. */
  width: min(520px, calc(100vw - 32px));
  flex-shrink: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-wide { width: min(880px, calc(100vw - 32px)); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-raised);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  flex-shrink: 0;
}
.modal-close {
  background: none; border: none;
  color: var(--ink-3);
  font-size: 20px; cursor: pointer;
  line-height: 1; padding: 4px 8px;
  border-radius: var(--r-sm, 6px);
  transition: background var(--t-fast, 120ms) ease, color var(--t-fast, 120ms) ease;
}
.modal-close:hover { background: var(--surface-sunken); color: var(--ink); }
.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-gutter: stable;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  flex-shrink: 0;
  flex-wrap: nowrap;     /* eine Zeile — Buttons schrumpfen, brechen nicht um */
  overflow-x: auto;      /* fallback bei extrem schmalem Modal */
}
.modal-footer .btn {
  flex: 0 1 auto;
  white-space: nowrap;
  min-width: 0;
}
@media (max-width: 640px) {
  .modal-footer { padding: 10px 12px; gap: 6px; }
  .modal-footer .btn { padding: 8px 10px; font-size: 13px; }
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (max-width: 640px) {
  .modal, .modal-wide { max-width: 100%; }
}

/* ──────────────────────────────────────────────────────────────
   Map-Popup (OpenStreetMap-Iframe, ueber Modals eingeblendet)
   ────────────────────────────────────────────────────────────── */
.map-popup-overlay {
  /* z-index ueber Sheets (9000) und Modals (9500), damit die Karte ueber
     dem Stammdaten-Edit-Sheet sichtbar ist. */
  position: fixed; inset: 0; z-index: 9800;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.map-popup {
  background: var(--bg-raised);
  border-radius: var(--r-md, 10px);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: min(480px, 95vw);
  overflow: hidden;
}
.map-popup-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--accent); color: var(--accent-fg);
}
.map-popup-title {
  font-size: 14px; font-weight: 700; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.map-popup-coords {
  font-size: 11px; opacity: 0.75; white-space: nowrap;
  font-family: var(--font-mono, monospace);
}
.map-popup-close {
  background: none; border: none;
  color: var(--accent-fg);
  font-size: 18px; cursor: pointer;
  line-height: 1; padding: 0 0 0 8px;
}
.map-popup-body iframe {
  display: block; width: 100%; height: 320px; border: 0;
}
.map-popup-footer {
  padding: 10px 14px;
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  border-top: 1px solid var(--border);
}
.map-popup-footer a {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.map-popup-footer a:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────────────────────
   Badges
   ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full, 9999px);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--accent-tint); color: var(--accent); }
.badge-amber { background: rgba(217, 119, 6, 0.15); color: var(--amber, #d97706); }
.badge-red { background: rgba(220, 38, 38, 0.12); color: var(--warn, #dc2626); }
.badge-neutral { background: var(--surface-sunken); color: var(--ink-3); }

/* ──────────────────────────────────────────────────────────────
   Location-Zeilen (Meine Orte)
   ────────────────────────────────────────────────────────────── */
.location-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.location-row:last-child { border-bottom: none; }
.location-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.location-info { flex: 1; min-width: 0; }
.location-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.location-addr { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.location-notes { font-size: 12px; color: var(--ink-4); font-style: italic; margin-top: 2px; }
.location-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* Klein-Varianten */
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
}
.icon-btn-sm {
  width: 32px; height: 32px;
  padding: 6px;
}

/* ──────────────────────────────────────────────────────────────
   Benutzer-Liste
   ────────────────────────────────────────────────────────────── */
.user-row-wrap {
  border-bottom: 1px solid var(--border);
}
.user-row-wrap:last-child { border-bottom: none; }
.user-row-wrap.is-inactive { opacity: 0.55; }

.user-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background var(--t-fast, 120ms) ease;
}
.user-row:hover { background: var(--surface-sunken); }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.user-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.user-side {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; min-width: 0;
}
.user-username {
  font-size: 12px; color: var(--ink-3);
  font-family: var(--font-mono, monospace);
}
.user-chev {
  color: var(--ink-3);
  flex-shrink: 0;
  transition: transform var(--t-fast, 120ms) ease;
}
.user-chev svg { width: 18px; height: 18px; }

.user-detail {
  background: var(--surface-sunken);
  border-top: 1px solid var(--border);
}
.user-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}
@media (max-width: 800px) {
  .user-detail-grid { grid-template-columns: 1fr; }
}
.user-detail-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  padding: 12px 14px;
}
.user-detail-card-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.user-detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 13px;
}
.user-detail-list dt {
  color: var(--ink-3);
  font-size: 12px;
}
.user-detail-list dd {
  margin: 0;
  color: var(--ink);
}

/* Kundensuch-Liste (Kalender-Termine) */
.cust-search-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast, 120ms) ease;
}
.cust-search-row:last-child { border-bottom: none; }
.cust-search-row:hover { background: var(--surface-sunken); }
.cust-search-name {
  font-weight: 600; font-size: 14px; color: var(--ink);
}
.cust-search-meta {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
}

/* ──────────────────────────────────────────────────────────────
   View-as-User Banner (Admin plant fuer einen Aussendienst-User)
   ────────────────────────────────────────────────────────────── */
.view-as-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  background: var(--amber, #d97706);
  color: #fff;
  padding: 8px 16px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.view-as-banner[hidden] { display: none; }
.view-as-banner .view-as-label { text-align: center; }
.view-as-banner .view-as-label strong { font-weight: 700; }
.view-as-banner .view-as-close {
  background: rgba(255,255,255,0.2);
  color: #fff; border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--t-fast, 120ms) ease;
}
.view-as-banner .view-as-close:hover { background: rgba(255,255,255,0.35); }
body.has-view-as-banner { padding-top: 44px; }
body.has-view-as-banner .bottom-nav,
body.has-view-as-banner #offline-banner { /* keep bottom positions */ }

/* (modal scrollbar-gutter in Haupt-Regel .modal oben) */

/* ──────────────────────────────────────────────────────────────
   Elemente die User-Aktivitaet sind (Besuch erfassen, Aufgabe
   abschliessen, Tour-Status aendern) werden im X-As-User-Modus
   (Admin plant fuer User) ausgegraut. Der Banner oben erklaert
   den Modus visuell.
   ────────────────────────────────────────────────────────────── */
body.has-view-as-banner .requires-own-context {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(60%);
}
/* Bei <button disabled> zusaetzlich den disabled-Style respektieren */
body.has-view-as-banner button.requires-own-context,
body.has-view-as-banner .requires-own-context button {
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────
   Sub-Nav (Action-Bar) fuer Feldapp-portierte Views
   (Besuchsplan, Kunden-Planung). Wird am Anfang des View-Containers
   gerendert und enthält die Haupt-Actions der View.
   ────────────────────────────────────────────────────────────── */
.view-subnav {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.subnav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 600;
  border-radius: var(--r-sm, 6px);
  transition: background var(--t-fast, 120ms) ease, color var(--t-fast, 120ms) ease, border-color var(--t-fast, 120ms) ease;
  white-space: nowrap;
  font-family: inherit;
}
.subnav-btn:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}
.subnav-btn.active {
  background: var(--accent-tint);
  color: var(--accent);
  border-color: var(--accent);
}
.subnav-btn.plan-dirty {
  animation: subnav-pulse 1.6s ease-in-out infinite;
  background: var(--warn-tint);
  color: var(--warn);
  border-color: var(--warn);
}
@keyframes subnav-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 45, 45, 0.25); }
  50%      { box-shadow: 0 0 0 6px rgba(217, 45, 45, 0); }
}
@media (max-width: 640px) {
  .subnav-btn { padding: 7px 10px; font-size: 12px; }
}

/* ──────────────────────────────────────────────────────────────
   Feldapp-portierte Views: Listen-Styles (besuchsplan)
   ────────────────────────────────────────────────────────────── */
.list-item {
  display: flex; align-items: flex-start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast, 120ms) ease;
  gap: 10px;
  color: var(--ink);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface-sunken); }
.list-item.marked { background: var(--accent-tint); }

.list-item-main { flex: 1; min-width: 0; }
.list-item-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.list-item-sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.list-item-right {
  width: 215px; flex-shrink: 0; text-align: left;
  font-size: 12px; color: var(--ink-3); white-space: nowrap;
}
.list-item-notes { flex: 1.5; min-width: 0; font-size: 12px; color: var(--ink-2); }
.list-item-note { font-size: 12px; color: var(--ink-2); margin-top: 3px; font-style: italic; }

.date-header {
  padding: 6px 14px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .5px;
}

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.dot-red    { background: #e74c3c; }
.dot-orange { background: #f39c12; }
.dot-green  { background: #27ae60; }
.dot-gray   { background: var(--ink-4); }

.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input {
  flex: 1; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm, 6px);
  font-size: 13px; background: var(--bg-raised); color: var(--ink);
  font-family: inherit;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }

/* Route-Stop (Besuchsplan-Liste) */
.route-stop {
  display: flex; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.route-stop:last-child { border-bottom: none; }
.route-stop:hover { background: var(--surface-sunken); }

/* Hinweis: Die globale .card hat padding:16 — fuer Listen-Container
   ueberschreiben wir das lokal via Inline-Style
   <div class="card" style="padding:0;overflow:hidden">. */

/* ──────────────────────────────────────────────────────────────
   Globale Override: Buttons + Pills mit moderater Rundung
   (Avatare, Status-Dots, Progress-Bars behalten ihre Form über
   eigene CSS-Regeln mit border-radius: 50% / Pixel-Werten.)
   ────────────────────────────────────────────────────────────── */
.btn, .btn-primary, .btn-secondary, .btn-tonal, .btn-ghost, .btn-lg, .btn-sm, .btn-block,
.quick-action, .quick-action.qa-accent,
.pill-toggle, .pill-toggle .pill,
.day-pill, .day-pill-row,
.tm-user-pill,
.tag-btn,
.opt-row,
.kpi-card,
.priority-badge,
.visit-type-badge,
.chip,
.task-cust-chip,
.icon-btn-dot::after,
.bp-map-tab,
.regal-card,
.cust-search-row .cust-tag,
.tag-pill {
  border-radius: var(--r-md) !important;
}

/* Date-Bar Heute-Button gleiche moderate Rundung */
.date-bar .btn { border-radius: var(--r-md); }

/* ──────────────────────────────────────────────────────────────
   Kunden-Liste — Sortier-Header + Datums-Gruppierung
   ────────────────────────────────────────────────────────────── */
.customer-head-sort {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background var(--t-fast);
}
.customer-head-sort:hover { background: var(--surface-sunken); color: var(--accent); }
.customer-head-sort.is-active { color: var(--accent); font-weight: 700; }

.customer-date-group {
  padding: 8px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
  /* In Grid-Layouts (customer-table) über alle Spalten strecken */
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
  text-transform: uppercase;
}
.customer-date-group:first-child { border-top: 1px solid var(--border); }
