/* =====================================================================
   unitysoft B2B ATLAS
   Aufmachung nach dem Vorbild von ATLAS (tigha): neutrale Stein-Palette,
   links die Händlerliste, in der Mitte die Karte, rechts der Händler.
   ===================================================================== */

:root {
  --ink: #1c1c1a;
  --ink-2: #45453f;
  --muted: #6b6b66;
  --faint: #9a9a93;
  --line: #e2e2df;
  --line-soft: #eeeeec;
  --page: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --hover: #f5f5f4;
  --sel: #f0f2ef;
  --accent: #4a6b4f;
  --accent-soft: #eef2ee;
  --red: #b4443a;
  --amber: #b07c1d;
  --left-w: 340px;
  --right-w: 356px;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: #c9c9c4; }
a:hover { text-decoration-color: var(--ink); }
.hidden { display: none !important; }

/* Abschnittsüberschriften im Detailpanel */
.label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ------------------------------------------------------------- Topbar */
header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  min-height: 50px;
  flex: 0 0 auto;
}
.brand { line-height: 1.05; padding-right: 4px; }
.brand b { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: 0.14em; }
.brand span {
  display: block; font-size: 8.5px; font-weight: 600;
  letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase;
}

/* Segment-Pills mit Zählern (Alle / Top / Kunden …) */
.segments { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.segment {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 13px; padding: 6px 11px; border-radius: var(--radius); white-space: nowrap;
}
.segment { transition: background 130ms ease, color 130ms ease; }
.segment:hover { background: var(--hover); }
.segment.active { background: var(--ink); color: #fff; }
.segment .n { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.segment.active .n { color: rgba(255,255,255,0.7); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
nav.views { display: flex; gap: 1px; background: var(--page); border-radius: 7px; padding: 2px; }
nav.views button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 500; padding: 5px 11px; border-radius: 5px; color: var(--ink-2);
}
nav.views button:hover { background: rgba(0,0,0,0.04); }
nav.views button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.07); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: 10.5px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; flex: 0 0 auto;
}
.user-name { font-size: 12.5px; color: var(--ink-2); }

/* ------------------------------------------------------------- Buttons */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 6px 11px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink);
}
.btn { transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease; }
.btn:hover { background: var(--hover); border-color: #d3d3cf; }
.btn:active { transform: translateY(0.5px); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #333330; border-color: #333330; }
.btn-danger { color: var(--red); border-color: #e8cdc9; }
.btn-danger:hover { background: #fbf1f0; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: left; }
.btn-link {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  font-size: 12.5px; color: var(--ink); text-decoration: underline; text-decoration-color: #c9c9c4;
}
.btn-link:hover { text-decoration-color: var(--ink); }

/* --------------------------------------------------------------- Main */
main { flex: 1 1 auto; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; overflow: auto; }
.view.split { overflow: hidden; display: flex; }

/* --------------------------------------------------- Linke Händlerliste */
.pane-list {
  width: var(--left-w); flex: 0 0 var(--left-w);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.pane-list .filters { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.pane-list input[type="search"], .pane-list select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 10px; background: var(--surface); font-size: 13px; margin-bottom: 7px;
}
.pane-list input[type="search"]:focus, .pane-list select:focus {
  outline: 2px solid #d8ddd6; outline-offset: -1px;
}
.pane-list .filters > *:last-child { margin-bottom: 0; }
.list-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted);
}
.list-scroll { flex: 1 1 auto; overflow-y: auto; }

.row {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.row { transition: background 120ms ease, box-shadow 120ms ease; }
.row:hover { background: var(--hover); box-shadow: inset 2px 0 0 var(--line); }
.row.selected { background: var(--sel); box-shadow: inset 2px 0 0 var(--accent); }
.row .dot { transition: transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.row:hover .dot { transform: scale(1.35); }
.row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.row .body { min-width: 0; flex: 1 1 auto; }
.row .name {
  font-size: 13.5px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .sub {
  font-size: 12px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .flag { font-size: 11px; margin-left: 5px; font-weight: 600; }
.row .nomail { color: var(--red); font-weight: 600; }
.list-more { padding: 12px; text-align: center; }
.list-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- Karte */
.pane-map { flex: 1 1 auto; position: relative; background: #e6e6e2; }
#map { position: absolute; inset: 0; }
.map-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 40px; background: var(--page); z-index: 5;
}
.map-fallback div { max-width: 420px; color: var(--ink-2); font-size: 13px; }
/* Händler-Punkt. Größe steckt in --pin, Farbe der Pipeline-Stufe in --c. */
.pin-icon { background: none; border: 0; }
.pin {
  display: block;
  width: var(--pin, 10px);
  height: var(--pin, 10px);
  border-radius: 50%;
  background: var(--c, #9a9a93);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transform-origin: 50% 50%;
  transition: transform 170ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 170ms ease, border-width 170ms ease;
  animation: pin-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
/* Händler mit hoher Priorität tragen einen zarten Hof, damit sie auffallen. */
.pin-hoch { box-shadow: 0 0 0 3px rgba(74, 107, 79, 0.22), 0 1px 3px rgba(0, 0, 0, 0.4); }
.pin-nomail { border-style: dashed; }

/* Maus drüber: deutlich größer, angehoben und mit Farbhof. */
.leaflet-marker-icon:hover .pin,
.pin:hover {
  transform: scale(2.1);
  border-width: 1.6px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, #9a9a93) 26%, transparent),
              0 4px 12px rgba(0, 0, 0, 0.32);
  z-index: 500;
}

/* Der ausgewählte Händler pulsiert dauerhaft. */
.pin.is-selected {
  transform: scale(1.7);
  border-color: var(--ink);
  animation: pin-pulse 1.9s ease-in-out infinite;
}
.pin.is-selected:hover { transform: scale(2.2); }

@keyframes pin-in {
  from { transform: scale(0.2); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes pin-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, #4a6b4f) 55%, transparent),
                         0 2px 6px rgba(0, 0, 0, 0.35); }
  55%      { box-shadow: 0 0 0 9px color-mix(in srgb, var(--c, #4a6b4f) 0%, transparent),
                         0 2px 6px rgba(0, 0, 0, 0.35); }
}

/* ----------------------------------------------------- Cluster-Blasen */
.cluster-icon { background: none; border: 0; }
.cl {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(28, 28, 26, 0.16);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 170ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 170ms ease;
}
.cl b { font-weight: 600; font-size: 12.5px; }
.cl-m b { font-size: 13px; }
.cl-l  { background: rgba(238, 242, 238, 0.96); border-color: #cfdccf; }
.cl-l b { font-size: 13.5px; }
.cl-xl { background: var(--accent); border-color: var(--accent); color: #fff; }
.cl-xl b { font-size: 14px; }
.leaflet-marker-icon:hover .cl {
  transform: scale(1.12);
  box-shadow: 0 5px 16px rgba(28, 28, 26, 0.26);
}

/* ------------------------------------------------------------- Popup */
.pop .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(28, 28, 26, 0.2);
  border: 1px solid var(--line);
  padding: 0;
}
.pop .leaflet-popup-content { margin: 0; padding: 12px 13px 13px 13px; font-size: 13px; }
.pop .leaflet-popup-tip { border: 1px solid var(--line); }
.pop .leaflet-popup-close-button { color: var(--faint); top: 5px; right: 6px; }
.pop .leaflet-popup-close-button:hover { color: var(--ink); background: none; }
.pop-head h4 { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.3; padding-right: 14px; }
.pop-place { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pop-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0 0; }
.pop-tags .badge-prio { background: var(--accent); }
.pop-lines { display: flex; flex-direction: column; gap: 3px; margin-top: 9px; }
.pop-link {
  font-size: 12.5px; color: var(--ink-2); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.pop-link:hover { color: var(--accent); text-decoration: underline; }
.pop-warn { color: var(--red); }
.pop-btn { width: 100%; margin-top: 11px; }

/* ------------------------------------------------- Rechtes Detailpanel */
.pane-detail {
  width: var(--right-w); flex: 0 0 var(--right-w);
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.pane-detail.empty { align-items: center; justify-content: center; padding: 30px; }
.pane-detail.empty p { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }
.detail-head {
  padding: 14px 16px 12px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: flex-start; gap: 8px;
}
.detail-head h2 { margin: 0; font-size: 16px; line-height: 1.25; font-weight: 600; flex: 1 1 auto; }
.detail-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 40px 16px; }
.detail-body section { margin-bottom: 20px; }
.detail-body section > .label { display: block; margin-bottom: 8px; }
.addr { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.addr .ref { color: var(--faint); font-size: 12px; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 5px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-word; }
.missing { color: var(--red); font-size: 12.5px; }

.qa {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius); padding: 9px 11px; margin-bottom: 6px;
  cursor: pointer; font-size: 13px; text-align: left;
}
.qa:hover { background: var(--hover); }
.qa .ico { font-size: 14px; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 9px; background: var(--surface); font-size: 13px;
}
.field textarea { min-height: 58px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 12px 12px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
}
.timeline .t-head { font-size: 13px; font-weight: 600; }
.timeline .t-meta { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.timeline .t-body { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; white-space: pre-wrap; }

.task-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
}
.task-item:last-child { border-bottom: 0; }
.task-item input[type="checkbox"] { margin-top: 2px; flex: 0 0 auto; }
.task-item.done .task-title { text-decoration: line-through; color: var(--faint); }
.task-title { font-size: 13px; font-weight: 500; }
.task-meta { font-size: 11.5px; color: var(--faint); }
.task-meta.overdue { color: var(--red); font-weight: 600; }

/* ------------------------------------------------------ Stufen-Auswahl */
.stage-select {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px;
  background: var(--surface); font-size: 13px;
}
.stage-select select { border: 0; background: transparent; flex: 1 1 auto; padding: 0; font-size: 13px; }
.stage-select select:focus { outline: none; }

/* -------------------------------------------------- Tabelle & Auswertung */
.wrap { padding: 20px; max-width: 1180px; margin: 0 auto; }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
table.grid th {
  position: sticky; top: 0; z-index: 2; background: var(--page); text-align: left;
  padding: 9px 12px; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
table.grid th:hover { color: var(--ink); }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--hover); }
.cell-name { font-weight: 600; }
.cell-sub { color: var(--faint); font-size: 12px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 11px;
  font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap;
}
.badge-soft {
  display: inline-block; padding: 1px 7px; border-radius: 11px; font-size: 11px;
  font-weight: 600; border: 1px solid currentColor; background: #fff; white-space: nowrap;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; }
.kpi .value { font-size: 27px; font-weight: 700; line-height: 1.1; }
.kpi .name { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kpi .hint { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 16px 18px; margin-top: 16px; }
.panel h2 { margin: 0 0 3px 0; font-size: 14.5px; }
.panel p.sub { margin: 0 0 14px 0; color: var(--muted); font-size: 12.5px; }
.bar-row { display: grid; grid-template-columns: 186px 1fr 54px; align-items: center; gap: 10px; margin-bottom: 6px; }
.bar-row .bar-label { font-size: 12.5px; color: var(--ink-2); }
.bar-track { background: var(--page); border-radius: 3px; height: 17px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; min-width: 2px; }
.bar-value { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- Login / Setup */
.center-screen {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: var(--page);
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 28px 30px; width: 100%; max-width: 400px;
}
.card h1 { margin: 0 0 5px 0; font-size: 18px; }
.card p.sub { margin: 0 0 18px 0; color: var(--muted); font-size: 13px; }
.card .btn-dark { width: 100%; padding: 10px; font-size: 14px; text-align: center; }
.alert {
  border-radius: var(--radius); padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px;
  background: #fbf1f0; border: 1px solid #e8cdc9; color: #8a352c;
}
.alert-ok { background: #eef4ee; border-color: #cfe0cf; color: #315636; }
.alert-info { background: #f2f4f6; border-color: #dce1e6; color: #3d4c58; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 18px; border-radius: var(--radius);
  font-size: 13px; z-index: 1200; box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

/* --------------------------------------------------------------- Handy */
@media (max-width: 1100px) {
  :root { --left-w: 290px; --right-w: 310px; }
}
@media (max-width: 900px) {
  .view.split { flex-direction: column; }
  .pane-list, .pane-detail {
    width: 100%; flex: 0 0 auto; max-height: 46vh; border: 0;
    border-bottom: 1px solid var(--line);
  }
  .pane-map { min-height: 300px; }
  header.topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .segments { order: 3; width: 100%; overflow-x: auto; }
  .topbar-right { margin-left: auto; }
}

/* ================================================================
   Feinschliff: ruhige Übergänge, dezente Scrollbalken, sichtbarer
   Tastaturfokus. Nichts davon verändert das Layout.
   ================================================================ */

#toast { animation: toast-in 220ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Panels und Detailbereich weich einblenden, wenn sie neu aufgebaut werden */
.pane-detail:not(.empty) .detail-head,
.pane-detail:not(.empty) .detail-body { animation: fade-up 200ms ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Scrollbalken: schmal und farblich ruhig */
.list-scroll, .detail-body, .view { scrollbar-width: thin; scrollbar-color: #d5d5d1 transparent; }
.list-scroll::-webkit-scrollbar, .detail-body::-webkit-scrollbar,
.view::-webkit-scrollbar { width: 9px; height: 9px; }
.list-scroll::-webkit-scrollbar-thumb, .detail-body::-webkit-scrollbar-thumb,
.view::-webkit-scrollbar-thumb {
  background: #d9d9d5; border-radius: 6px; border: 2px solid var(--surface);
}
.list-scroll::-webkit-scrollbar-thumb:hover, .detail-body::-webkit-scrollbar-thumb:hover,
.view::-webkit-scrollbar-thumb:hover { background: #c2c2bd; }

/* Tastaturfokus sichtbar machen, Mausklicks aber nicht umranden */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.segment:focus-visible, nav.views button:focus-visible { outline-offset: 0; }

/* Zoom-Bedienelemente der Karte an die Palette angleichen */
.leaflet-bar a {
  color: var(--ink-2); border-bottom-color: var(--line-soft);
  transition: background 130ms ease, color 130ms ease;
}
.leaflet-bar a:hover { color: var(--ink); background: var(--hover); }
.leaflet-control-zoom { box-shadow: 0 2px 8px rgba(28, 28, 26, 0.14) !important; border: 0 !important; }
.leaflet-control-zoom a { border-radius: 0; }
.leaflet-control-zoom a:first-child { border-radius: 6px 6px 0 0; }
.leaflet-control-zoom a:last-child { border-radius: 0 0 6px 6px; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, 0.82) !important; }

/* Wer Bewegung reduziert haben möchte, bekommt keine */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ================================================================
   Fortschritt, Massenbearbeitung, Import-Dialog
   ================================================================ */

/* --- Ring in der Händlerliste --- */
.row .ring-wrap { flex: 0 0 auto; line-height: 0; margin-top: 1px; }
.ring circle:last-of-type { transition: stroke-dasharray 400ms ease; }
.row .sub .dot { display: inline-block; width: 7px; height: 7px; margin: 0 5px 0 0; vertical-align: 1px; }

/* --- Auswahlkästchen --- */
.row .pick {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: 8px; border-radius: 4px;
  border: 1.5px solid #cfcfca; background: var(--surface); cursor: pointer; position: relative;
  transition: border-color 120ms ease, background 120ms ease;
}
.row .pick:hover { border-color: var(--accent); }
.row.picked .pick { background: var(--accent); border-color: var(--accent); }
.row.picked .pick::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}
.row.picked { background: #f2f5f1; }
.meta-actions { display: flex; gap: 12px; }

/* --- Balken im Detailbereich --- */
.progress { margin: 0 0 16px 0; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.progress-label { font-size: 12.5px; color: var(--ink-2); }
.progress-value { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-track {
  position: relative; height: 9px; border-radius: 5px;
  background: var(--line-soft); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 5px;
  animation: bar-fill 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bar-fill { from { width: 0 !important; } }
.progress-tick {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--surface); transform: translateX(-1px);
}
.progress-marks {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-size: 10.5px; color: var(--faint);
}
.progress-marks span { flex: 1 1 0; text-align: right; }
.progress-marks span.on { font-weight: 600; }

/* --- Leiste für die Massenbearbeitung --- */
.bulkbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(28, 28, 26, 0.18);
  padding: 9px 12px; z-index: 1100;
  animation: bulk-in 200ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes bulk-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.bulk-count {
  font-size: 12.5px; font-weight: 600; background: var(--ink); color: #fff;
  padding: 4px 9px; border-radius: 5px; white-space: nowrap;
}
.bulkbar select, .bulkbar input {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 5px 8px; font-size: 12.5px; background: var(--surface);
}
.bulk-progress { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Dialoge --- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(28, 28, 26, 0.34);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; z-index: 1300;
  animation: fade-in 150ms ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 10px; width: 100%; max-width: 780px;
  padding: 18px 20px 22px 20px; box-shadow: 0 18px 50px rgba(28, 28, 26, 0.28);
  animation: modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.modal code { font-size: 11.5px; background: var(--page); padding: 1px 4px; border-radius: 3px; }
.modal textarea {
  width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
}
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
#imp-preview .tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#imp-preview .tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line); padding: 6px 8px;
}
#imp-preview .tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); }

/* ================================================================
   Aufgefächerte Punkte: größer und mit Namen, damit sie im
   Kartenbild nicht untergehen
   ================================================================ */
.pin-label {
  position: absolute; left: 50%; top: 100%;
  transform: translate(-50%, 6px) scale(0.9);
  transform-origin: 50% 0;
  white-space: nowrap; pointer-events: none;
  font-style: normal; font-size: 11.5px; font-weight: 600; line-height: 1;
  color: var(--ink); background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px;
  box-shadow: 0 2px 7px rgba(28, 28, 26, 0.16);
  opacity: 0; visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}
/* Beim Aufklappen einer Blase: Punkte deutlich größer und mit weißem Ring,
   damit sie sich vom Kartenbild abheben. Die Namen erscheinen beim Überfahren
   – dauerhaft eingeblendet überlagern sie sich bei eng beieinander liegenden
   Firmen gegenseitig und man liest gar nichts mehr. */
.leaflet-marker-icon.spider .pin {
  transform: scale(1.9);
  border-width: 2.5px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 3px 9px rgba(0, 0, 0, 0.3);
}
.leaflet-marker-icon.spider .pin.is-selected { transform: scale(2.2); }
.leaflet-marker-icon.spider:hover .pin { transform: scale(2.6); }
.leaflet-marker-icon.spider:hover { z-index: 900 !important; }

/* Während markercluster die Punkte animiert, dürfen unsere eigenen
   Übergänge nicht mitlaufen: ihr transitionend steigt sonst auf und
   markercluster beendet die Animation zu früh – die Punkte bleiben dann
   an der Blase kleben, während die Verbindungslinien schon außen stehen. */
.leaflet-cluster-anim .pin,
.leaflet-cluster-anim .pin-label,
.leaflet-cluster-anim .cl { transition: none !important; animation: none !important; }
/* Auch beim bloßen Überfahren eines einzelnen Punktes den Namen zeigen */
.leaflet-marker-icon:hover .pin-label {
  opacity: 1; visibility: visible; transform: translate(-50%, 12px) scale(1);
}
/* Die Fäden, an denen die Punkte hängen, etwas kräftiger */
.leaflet-cluster-spider-leg { stroke: #8f8f88 !important; stroke-width: 1.4 !important; }

/* ================================================================
   Kalender
   ================================================================ */
.cal-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.cal-nav { display: flex; gap: 4px; }
.cal-nav .btn { min-width: 32px; }
.cal-legend { margin-left: auto; display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i, .cal-item i {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto;
}

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.cal-wd {
  background: var(--surface-2); padding: 7px 9px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint);
}
.cal-day {
  background: var(--surface); min-height: 96px; padding: 5px 6px 7px 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-day.fremd { background: var(--surface-2); }
.cal-day.fremd .cal-date { color: #c4c4bf; }
.cal-day.heute { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-day.heute .cal-date { color: var(--accent); font-weight: 700; }
.cal-item {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 11.5px; line-height: 1.25; padding: 2px 4px; border-radius: 4px;
  background: var(--page); transition: background 120ms ease;
}
.cal-item:hover { background: var(--sel); }
.cal-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.done span { color: var(--faint); text-decoration: line-through; }
.cal-more { font-size: 10.5px; color: var(--faint); padding-left: 4px; }

@media (max-width: 900px) {
  .cal-day { min-height: 68px; }
  .cal-item span { display: none; }
  .cal-legend { width: 100%; margin-left: 0; }
}

/* ================================================================
   Dokumente je Händler
   ================================================================ */
.doc-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.doc-item:last-child { border-bottom: 0; }
.doc-kind {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; color: #fff; flex: 0 0 auto;
}
.doc-angebot { background: #8b5cf6; }
.doc-rechnung { background: var(--accent); }
.doc-title {
  flex: 1 1 auto; min-width: 0; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-meta { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.btn-danger-link { color: var(--red); }
#docs-section input[type="file"] { font-size: 12px; }

/* Rückgängig-Knopf: unauffällig, solange nichts anliegt */
#btn-undo {
  min-width: 34px; font-size: 14px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
#btn-undo:disabled { opacity: 0.4; cursor: default; }
#btn-undo:not(:disabled) { border-color: #d3d3cf; font-weight: 600; }

/* ================================================================
   Rechte Spalte: mehr Hierarchie, Farbe und direkte Aktionen
   ================================================================ */
.detail-head {
  padding: 15px 16px 13px 16px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.detail-head h2 { font-size: 17px; letter-spacing: -0.01em; }

.ident { margin-bottom: 16px; }
.ident-place {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-2);
}
.ident-flag { font-size: 15px; line-height: 1; }
.ident-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.chip {
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  padding: 3px 8px; border-radius: 999px;
  color: color-mix(in srgb, var(--chip) 78%, #1c1c1a);
  background: color-mix(in srgb, var(--chip) 13%, #fff);
  border: 1px solid color-mix(in srgb, var(--chip) 28%, #fff);
}
.chip-ghost { text-transform: capitalize; }

.ident-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.qlink {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; text-decoration: none;
  padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}
a.qlink:hover { background: var(--accent-soft); border-color: #cfdccf; color: var(--accent); }
a.qlink:active { transform: translateY(0.5px); }
.qlink.off { color: var(--faint); border-style: dashed; background: transparent; }

/* Abschnitte deutlicher voneinander absetzen */
.detail-body .sec {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 12px 13px;
  margin-bottom: 14px;
}
.detail-body .sec > .label { margin-bottom: 9px; }
.sec-stage { background: var(--surface); }

/* Pipeline als Pillenleiste statt Auswahlfeld */
.stage-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.spill {
  font-size: 11.5px; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  transition: all 140ms ease;
}
.spill:hover { border-color: var(--sc); color: color-mix(in srgb, var(--sc) 80%, #1c1c1a); }
.spill.on {
  background: var(--sc); border-color: var(--sc); color: #fff;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--sc) 45%, transparent);
}

/* Schnellaktionen etwas kräftiger */
.qa {
  transition: background 130ms ease, border-color 130ms ease, transform 130ms ease;
}
.qa:hover { border-color: #cfdccf; background: var(--accent-soft); }
.qa:active { transform: translateY(0.5px); }
.qa .ico { font-size: 14px; }

/* Kartenlegende */
.map-legend {
  position: absolute; top: 12px; right: 12px; z-index: 500;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 3px 14px rgba(28, 28, 26, 0.14);
  padding: 9px 10px; max-width: 232px;
  backdrop-filter: saturate(1.2) blur(3px);
}
.legend-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.legend-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint);
}
.legend-switch { display: flex; background: var(--page); border-radius: 6px; padding: 2px; }
.legend-switch button {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 4px;
}
.legend-switch button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.legend-items { display: flex; flex-direction: column; gap: 1px; margin-top: 7px; }
.legend-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  font-size: 11.5px; color: var(--ink-2); padding: 3px 5px; border-radius: 5px;
  transition: background 120ms ease;
}
.legend-item:hover { background: var(--hover); }
.legend-item.on { background: var(--sel); font-weight: 600; color: var(--ink); }
.legend-item i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.legend-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Punkte: Rand trägt jetzt die jeweils andere Angabe */
.pin { border-color: var(--rand, #fff); border-width: 3px; }
.pin-hoch { box-shadow: 0 0 0 3px rgba(255,255,255,0.75), 0 1px 4px rgba(0,0,0,0.4); }

@media (max-width: 900px) {
  .map-legend { max-width: 170px; top: 8px; right: 8px; padding: 7px 8px; }
  .legend-items { max-height: 118px; overflow-y: auto; }
}

/* ================================================================
   Gewonnene Kunden und Fit-Einstufung
   ================================================================ */
.won-star {
  color: #d4a017; font-size: 17px; line-height: 1;
  text-shadow: 0 1px 2px rgba(212, 160, 23, 0.35);
}
.won-star.sm { font-size: 12px; }
.won-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: linear-gradient(135deg, #f3f7f2, #eaf1e8);
  border: 1px solid #cfdccf; border-radius: 9px;
  padding: 11px 13px; margin-bottom: 14px;
  animation: won-in 380ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.won-banner .won-star { font-size: 22px; margin-top: -1px; }
.won-banner b { font-size: 13px; color: var(--accent); display: block; }
.won-banner div div { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
@keyframes won-in { from { opacity: 0; transform: scale(0.97); } }

.fit-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  vertical-align: 1px; margin-left: 2px;
}
.chip-fit { font-weight: 700; }

/* ================================================================
   Bestellungen im Detailbereich
   ================================================================ */
.sec-orders { background: var(--surface); }
.order-sum {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 9px 11px; margin-bottom: 10px;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 7px;
}
.order-sum div { display: flex; flex-direction: column; gap: 1px; }
.order-sum span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }
.order-sum b { font-size: 14px; font-variant-numeric: tabular-nums; }
.order-sum b.ok { color: var(--accent); }
.order-sum b.warn { color: var(--amber); }

.order-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.order-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
  background: var(--surface);
}
.order-item.bezahlt { border-color: #cfdccf; background: #fbfdfa; }
.order-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.order-date { font-size: 12.5px; font-weight: 600; }
.order-no { font-size: 11.5px; color: var(--faint); }
.order-total { margin-left: auto; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-state { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.order-state.ok { background: var(--accent-soft); color: var(--accent); }
.order-state.open { background: #fdf4e3; color: var(--amber); }
.order-lines { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.order-lines span { font-size: 12px; color: var(--ink-2); }
.order-lines i { color: var(--faint); font-style: normal; font-size: 11.5px; }
.order-note { font-size: 12px; color: var(--muted); margin-top: 5px; font-style: italic; }
.order-actions { display: flex; gap: 12px; margin-top: 7px; }
.order-list .leer, .panel .leer { color: var(--faint); font-size: 12.5px; }

.order-new {
  margin-top: 10px; padding: 11px; border: 1px dashed var(--line);
  border-radius: 8px; background: var(--surface-2);
}
.order-rows { display: flex; flex-direction: column; gap: 5px; margin: 4px 0 6px 0; }
.order-row { display: grid; grid-template-columns: 1fr 52px 68px auto 20px; gap: 5px; align-items: center; }
.order-row select, .order-row input {
  border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px;
  font-size: 12px; background: var(--surface); width: 100%;
}
.order-row .o-line {
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted);
  text-align: right; white-space: nowrap; min-width: 64px;
}
.order-row .o-del { color: var(--faint); font-size: 15px; line-height: 1; }
.order-row .o-del:hover { color: var(--red); }
.order-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.o-paid { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.order-total-big { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ================================================================
   Auswertung
   ================================================================ */
.dash-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.dash-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.kpis-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi .hint { font-size: 11px; color: var(--faint); margin-top: 2px; }
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px; margin-top: 14px;
}
.panel-wide { grid-column: 1 / -1; }
.dash-grid .panel h2 { font-size: 14px; margin: 0 0 3px 0; }
.dash-grid .panel .sub { font-size: 11.5px; margin: 0 0 11px 0; line-height: 1.45; }

.bar-row { display: grid; grid-template-columns: 128px 1fr auto; gap: 9px; align-items: center; margin-bottom: 6px; }
.bar-label {
  font-size: 12px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { height: 9px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width 420ms cubic-bezier(0.22,1,0.36,1); }
.bar-value {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap; min-width: 54px;
}
.bar-value i { display: block; font-style: normal; font-size: 10.5px; font-weight: 400; color: var(--faint); }

.cols { width: 100%; height: 150px; display: block; }
.cols-x {
  display: grid; grid-template-columns: repeat(12, 1fr);
  font-size: 9.5px; color: var(--faint); text-align: center; margin-top: 3px;
}
.cols-max { font-size: 10.5px; color: var(--faint); margin-top: 5px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line); padding: 6px 8px;
}
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.tbl tbody tr:hover { background: var(--hover); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .bar-row { grid-template-columns: 96px 1fr auto; }
  .order-row { grid-template-columns: 1fr 46px 60px; }
  .order-row .o-line, .order-row .o-del { display: none; }
}

/* =====================================================================
   Textbausteine, Signaturen, Nachfass-Rhythmus und gebündelter Versand
   ===================================================================== */

/* --- Vollflächiger Hintergrund für die großen Dialoge --- */
.overlay {
  position: fixed; inset: 0; background: rgba(28, 28, 26, 0.38);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 20px; overflow-y: auto; z-index: 1400;
  animation: fade-in 140ms ease both;
}
.overlay .card {
  max-width: none; padding: 0; border: 0;
  box-shadow: 0 20px 56px rgba(28, 28, 26, 0.3);
  animation: modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.overlay .camp { width: 100%; max-width: 730px; display: flex; flex-direction: column; }
.overlay .tpl  { width: 100%; max-width: 1120px; }
/* Im Dialog sind Schaltflächen nebeneinander – die Karten-Regel, die den
   dunklen Knopf über die volle Breite zieht, gilt hier nicht. */
.overlay .card .btn, .overlay .card .btn-dark {
  width: auto; padding: 6px 13px; font-size: 12.5px; text-align: center;
}
.overlay .card .camp-foot .btn-dark { padding: 8px 18px; font-size: 13px; }
.camp-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 22px 14px 22px; border-bottom: 1px solid var(--line);
}
.camp-head h1 { margin: 0 0 2px 0; font-size: 17px; }
.camp-head p.sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.camp-head .sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.camp-body { padding: 4px 22px 18px 22px; max-height: calc(100vh - 210px); overflow-y: auto; }
.camp-sec { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.camp-sec:last-child { border-bottom: 0; }
.camp-sec .label { display: block; margin-bottom: 9px; }

.camp-zahl { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; }
.camp-zahl b { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.camp-zahl span { font-size: 12.5px; color: var(--muted); }

.camp-raus {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 9px 12px; margin-bottom: 10px;
}
.camp-raus-zeile { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; color: var(--muted); }
.camp-raus-zeile b { color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 26px; text-align: right; }
.camp-hinweis { font-size: 12.5px; color: var(--muted); margin: 0 0 8px 0; line-height: 1.5; }
.camp-check {
  display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px;
  color: var(--ink-2); cursor: pointer; margin-top: 6px; line-height: 1.45;
}
.camp-check input { margin: 2px 0 0 0; flex: 0 0 auto; }

.camp-kanal, .tpl-arten { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.kbtn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 6px 13px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  transition: background 130ms ease, border-color 130ms ease;
}
.kbtn:hover { background: var(--hover); }
.kbtn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.kbtn .n { font-size: 11px; opacity: 0.65; font-variant-numeric: tabular-nums; }

.camp-absender {
  background: #fdf8ec; border: 1px solid #ecdcb8; border-radius: var(--radius);
  padding: 11px 13px; margin: 10px 0 12px 0;
}
.camp-absender b { font-size: 12.5px; }
.camp-absender p { margin: 2px 0 8px 0; font-size: 12px; color: var(--muted); }

.camp-ph { font-size: 11.5px; color: var(--faint); margin: 6px 0 8px 0; line-height: 2; }
.phbtn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 4px;
  padding: 2px 6px; margin-left: 4px; cursor: pointer; color: var(--ink-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}
.phbtn:hover { background: var(--accent-soft); border-color: #cfdccf; color: var(--accent); }

/* --- Vorschau --- */
.camp-vorschau, .tpl-vorschau > div, #tpl-vorschau {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 12px 14px;
}
.vp-an { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.vp-subject { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.vp-body { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; }
.vp-warn {
  margin-top: 10px; font-size: 12px; line-height: 1.5;
  background: #fbf1f0; border: 1px solid #e8cdc9; color: #8a352c;
  border-radius: var(--radius); padding: 7px 10px;
}
.camp-vorschau-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px;
}
.camp-vorschau-nav span { font-size: 11.5px; color: var(--faint); }

.camp-folgen { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.camp-folgen b { font-weight: 600; }

.camp-foot {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 13px 22px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 11px 11px;
}
.camp-fortschritt { margin-right: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.camp-wa { max-width: 520px; padding: 0 22px 18px 22px; }
.camp-wa .camp-head { padding-left: 0; padding-right: 0; }

/* --- Verwaltung der Vorlagen --- */
.tpl { padding: 0 22px 18px 22px; }
.tpl .camp-head { padding-left: 0; padding-right: 0; }
.tpl-arten { padding-top: 14px; }
.tpl-split { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.tpl-liste { display: flex; flex-direction: column; gap: 2px; max-height: 62vh; overflow-y: auto; }
.tpl-item {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  border: 0; background: transparent; border-radius: var(--radius);
  padding: 7px 9px; cursor: pointer; width: 100%;
}
.tpl-item:hover { background: var(--hover); }
.tpl-item.on { background: var(--sel); box-shadow: inset 2px 0 0 var(--accent); }
.tpl-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.tpl-meta { font-size: 11px; color: var(--faint); display: flex; gap: 6px; }
.tpl-std { color: var(--accent); font-weight: 600; }
.tpl-form { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.tpl-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.55; }
.tpl-vorschau { position: sticky; top: 0; }
.tpl-vorschau .label { display: block; margin-bottom: 8px; }
.tpl-vorschau #tpl-vorschau { max-height: 56vh; overflow-y: auto; }
.tpl-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  position: sticky; bottom: 0; background: var(--surface);
  padding: 10px 0 4px 0; border-top: 1px solid var(--line-soft);
}
.tpl-absender { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.tpl-absender .field-row { grid-template-columns: repeat(5, 1fr); }

/* --- Nachfass-Rhythmus in der Detailspalte --- */
.sec-followup { background: var(--surface); }
.fu-next {
  border-left: 2px solid var(--line); padding: 2px 0 2px 10px; margin-bottom: 10px;
}
.fu-next.due { border-left-color: var(--amber); }
.fu-next b { font-size: 13px; }
.fu-next span { font-size: 11.5px; color: var(--faint); margin-left: 7px; font-variant-numeric: tabular-nums; }
.fu-next p { margin: 3px 0 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.fu-leer { font-size: 12.5px; color: var(--faint); margin: 0 0 10px 0; }
.fu-strahl { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.fu-step {
  display: flex; align-items: baseline; gap: 8px; padding: 4px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.fu-step:last-child { border-bottom: 0; }
.fu-dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); border: 1px solid #d3d3cf; align-self: center;
}
.fu-step.due .fu-dot { background: var(--amber); border-color: var(--amber); }
.fu-step.done .fu-dot { background: var(--accent); border-color: var(--accent); }
.fu-titel { flex: 1 1 auto; color: var(--ink-2); }
.fu-step.done .fu-titel { color: var(--faint); text-decoration: line-through; text-decoration-color: #cfcfca; }
.fu-step.due .fu-titel { font-weight: 600; color: var(--ink); }
.fu-datum { font-size: 11.5px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fu-hilfe { display: block; margin-top: 7px; font-size: 11px; color: var(--faint); }

/* --- Kleinigkeiten --- */
.bulk-trenner { width: 1px; height: 20px; background: var(--line); flex: 0 0 auto; }
.qlink-btn { cursor: pointer; font: inherit; }
button.qlink:hover { background: var(--accent-soft); border-color: #cfdccf; color: var(--accent); }

@media (max-width: 1180px) {
  .tpl-split { grid-template-columns: 200px minmax(0, 1fr); }
  .tpl-vorschau { display: none; }
}
