:root {
  --accent: #1a5276;
  --accent-light: #2471a3;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2833;
  --muted: #6b7a8a;
  --border: #dde3e8;
  --ok: #1e8449;
  --warn: #b9770e;
  --err: #c0392b;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  background: var(--accent); color: #fff;
  padding: 0 16px;
}
.topbar-row {
  display: flex; align-items: center; gap: 14px;
  height: 52px;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; flex-shrink: 0; }
.brand span { font-weight: 300; }
.topbar-user { margin-left: auto; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-user a { color: #cfe3f0; margin-left: 0; }
.burger {
  display: none; background: none; border: none; color: #fff;
  cursor: pointer; padding: 4px 6px; line-height: 0;
}
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg {
  width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.sidenav {
  position: fixed; top: 52px; left: 0; bottom: 0; width: 220px; z-index: 15;
  background: #fff; border-right: 1px solid var(--border);
  padding: 10px 0 20px; overflow-y: auto;
}
.nav-group {
  padding: 18px 20px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.nav-group:first-child { padding-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  margin: 1px 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active {
  background: rgba(26, 82, 118, .1); color: var(--accent); font-weight: 600;
}
.nav-icon {
  flex-shrink: 0; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon svg {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.nav-label { line-height: 1.2; }
main { margin: 52px 0 0 220px; padding: 24px; max-width: 1200px; }
main.main-full { margin: 0; max-width: none; }
.app-footer {
  /* gleiche Spalte wie main (220 + max 1200), sonst wirkt © „versetzt“ */
  margin: 0 0 0 220px; padding: 18px 24px 28px;
  max-width: 1200px; box-sizing: border-box;
  font-size: 12px; color: var(--muted); text-align: center;
}
body:not(:has(.sidenav)) .app-footer,
main.main-full ~ .app-footer {
  margin-left: 0;
}

@media (max-width: 820px) {
  .burger { display: block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; width: 240px; }
  body.nav-open .sidenav { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.3); }
  main { margin-left: 0; padding: 14px; }
  .app-footer { margin-left: 0; padding: 14px 14px 22px; }
}

/* Topbar-Suche */
.topbar-suche {
  flex: 1; max-width: 340px; margin-left: 8px; position: relative;
  display: flex; align-items: center;
}
.gs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  min-width: 320px; max-width: 480px; max-height: min(70vh, 520px);
  overflow-y: auto; z-index: 40;
  background: #fff; color: var(--text);
  border: 1px solid var(--border, #dde3e8); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  padding: 8px;
}
.gs-panel.is-loading { opacity: 0.6; }
.gs-gruppe { margin-bottom: 8px; }
.gs-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding: 4px 8px;
}
.gs-zeile {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: 6px;
  color: inherit; text-decoration: none;
}
.gs-zeile:hover { background: var(--bg, #f4f6f8); text-decoration: none; }
.gs-zeile strong { font-size: 13.5px; }
.gs-zeile span { font-size: 12px; color: var(--muted); }
.gs-alle {
  display: block; text-align: center; padding: 10px;
  font-size: 13px; font-weight: 600; border-top: 1px solid var(--border);
  margin-top: 4px;
}
@media (max-width: 820px) {
  .topbar-suche-mobile .gs-panel {
    left: 0; right: 0; min-width: 0; max-width: none; width: 100%;
  }
}
.topbar-suche-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: #cfe3f0; pointer-events: none; line-height: 0;
}
.topbar-suche-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.topbar-suche input {
  width: 100%; padding: 7px 12px 7px 34px; border: none; border-radius: 20px;
  font-size: 13.5px; background: rgba(255,255,255,.18); color: #fff;
}
.topbar-suche input::placeholder { color: #cfe3f0; }
.topbar-suche input:focus { background: #fff; color: var(--text); outline: none; }
.topbar-suche input:focus ~ .topbar-suche-icon,
.topbar-suche:focus-within .topbar-suche-icon { color: var(--muted); }
.topbar-suche-mobile { display: none; }
.topbar-suche-mobile .topbar-suche-icon { color: var(--muted); }
.topbar-suche-mobile input {
  padding-left: 38px;
}

@media (max-width: 820px) {
  /* Suche ganz oben, volle Breite – auch auf Dashboard */
  .topbar {
    padding: 8px 12px 10px;
  }
  .topbar-row { height: 40px; gap: 8px; }
  .topbar-suche-desktop { display: none; }
  .topbar-suche-mobile {
    display: block;
    flex: none;
    max-width: none;
    margin: 6px 0 0;
    width: 100%;
    position: relative;
  }
  .topbar-suche-mobile .topbar-suche-icon {
    left: 14px;
    color: var(--muted);
  }
  .topbar-suche-mobile input {
    padding: 11px 14px 11px 42px; /* Platz für Lupe links */
    font-size: 16px; /* kein iOS-Zoom */
    border-radius: 10px;
    background: #fff;
    color: var(--text);
  }
  .topbar-suche-mobile input::placeholder { color: var(--muted); }
  .topbar-user-name { display: none; }
  .sidenav { top: 102px; }
  main { margin-top: 102px; }
}

/* Komponenten */
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; margin-bottom: 18px;
}
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi-hide-intern .kpi-intern { display: none; }
.kpi { text-align: center; padding: 16px 10px; }
.kpi .wert { font-size: 26px; font-weight: 700; color: var(--accent); }
.kpi .label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.tbl th { background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; }
.tbl tr:hover td { background: #eef3f7; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }

.pos-befehl-leiste {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 8px;
}
.pos-befehl-leiste input[type=text],
.pos-befehl-leiste select {
  flex: 1; min-width: 180px; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff;
}
.pos-baustein-leiste select { max-width: 280px; flex: 0 1 280px; }
.pos-befehl-details summary { user-select: none; }
.pos-befehl-echo {
  margin: 0 0 10px; font-size: 13px; min-height: 1.2em;
}
.pos-befehl-echo.is-error { color: var(--err); font-weight: 600; }
#pos-tabelle tbody tr.pos-cmd-hit td {
  background: #fff3a3 !important;
  transition: background 0.4s ease;
}
#pos-tabelle tbody tr.pos-sub td.pos-nr {
  padding-left: 14px;
  color: #555;
  font-size: 0.95em;
}
#pos-tabelle .pos-select,
#pos-select-all {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  box-sizing: border-box; min-height: 40px; line-height: 1.25;
  background: var(--accent); color: #fff !important;
  border: 1px solid var(--accent); border-radius: 7px; padding: 8px 16px; font-size: 14px;
  font-weight: 600; cursor: pointer; text-decoration: none !important; font-family: inherit;
}
.btn:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-sec { background: #fff; color: var(--accent) !important; border: 1px solid var(--accent); }
.btn-sec:hover { background: #eef3f7; }
.btn-sm { min-height: 0; padding: 4px 10px; font-size: 12.5px; }
.btn-danger { background: var(--err); }
.btn-ok { background: var(--ok); }

form.inline { display: inline; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-group { margin-bottom: 8px; }
.form-group-sm { max-width: 120px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: #d5f0e0; color: var(--ok); }
.flash-error { background: #fadbd8; color: var(--err); }

/* Angebot: Auto-Save Status nur bei Erfolg – absolut, kein Layout-Sprung */
.angebot-meta-head {
  position: relative;
  padding-right: 110px;
}
.angebot-meta-status {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  background: rgba(213, 240, 224, 0.55);
  color: var(--ok);
  border: 1px solid rgba(207, 232, 216, 0.55);
  pointer-events: none;
  white-space: nowrap;
}
.angebot-meta-status[hidden],
.angebot-meta-status:empty {
  display: none !important;
}
.angebot-meta-status.is-ok {
  display: inline-block;
  background: rgba(213, 240, 224, 0.55);
  color: var(--ok);
}
.angebot-meta-status.is-err {
  display: inline-block;
  background: rgba(250, 219, 216, 0.7);
  color: var(--err);
  border-color: rgba(245, 198, 203, 0.6);
}
.flash-stack { margin-bottom: 14px; transition: opacity .35s ease, transform .35s ease; }
.flash-stack .flash { margin-bottom: 8px; }
.flash-stack .flash:last-child { margin-bottom: 0; }
.flash-stack.is-hiding { opacity: 0; transform: translateY(-6px); pointer-events: none; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-neu, .badge-entwurf, .badge-offen, .badge-angebot_gesendet { background: #d6eaf8; color: var(--accent); }
.badge-kontaktiert, .badge-nicht_erreicht, .badge-versendet, .badge-bestellt, .badge-lieferung_erwartet, .badge-warten_zahlung { background: #fdebd0; color: var(--warn); }
.badge-qualifiziert, .badge-gespraech, .badge-interesse, .badge-termin, .badge-nachfass, .badge-montiert { background: #e8daef; color: #6c3483; }
.badge-uebergeben, .badge-angenommen, .badge-geliefert, .badge-abgeschlossen, .badge-bezahlt { background: #d5f0e0; color: var(--ok); }
.badge-verloren, .badge-kein_interesse, .badge-gesperrt, .badge-abgelehnt, .badge-abgelaufen, .badge-offen-zahlung { background: #fadbd8; color: var(--err); }
.badge-reklamation { background: #fdebd0; color: var(--warn); }
.badge-ersetzt { background: #eaecee; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar select { width: auto; }
.muted { color: var(--muted); font-size: 13px; }
.right { text-align: right; }

/* Angebots-Editor Positionstabelle */
#pos-tabelle .pos-aktionen {
  white-space: nowrap;
  display: flex;
  gap: 2px;
  align-items: center;
}
#pos-tabelle .pos-aktionen .btn { padding: 2px 6px; min-width: 26px; }
#pos-tabelle input { padding: 6px 8px; font-size: 13.5px; }
#pos-tabelle td { padding: 4px 6px; }
#pos-tabelle .pos-summe { font-weight: 600; white-space: nowrap; }
.summenblock { margin-top: 12px; text-align: right; font-size: 15px; }
.summenblock .gesamt { font-size: 18px; font-weight: 700; color: var(--accent); }

/* Login */
.login-box {
  max-width: 360px; margin: 12vh auto; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; padding: 30px;
}
.login-box h1 { text-align: center; color: var(--accent); }

/* Prüf-Stufe: Seiten-Vorschau */
.seiten-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.seite-karte {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.seite-karte img {
  width: 100%; display: block; border-bottom: 1px solid var(--border);
  background: #fff;
}
.seite-fuss {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; font-size: 13px; gap: 6px; flex-wrap: wrap;
}
.seite-aktionen { display: flex; gap: 4px; align-items: center; }
.seite-aktionen .btn-sm { padding: 2px 8px; min-width: 28px; }
.pruef-multi-leiste {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.pruef-multi-links {
  display: inline-flex; align-items: center; gap: 12px;
  flex-wrap: nowrap; white-space: nowrap; font-size: 14px;
}
.pruef-multi-all { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.pruef-multi-links #pruef-select-count { line-height: 1.2; }
.seite-wahl {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 0; font-size: 13px; cursor: pointer;
}
.seite-karte.is-selected { outline: 2px solid var(--accent); }

/* Projektmappe */
.dok-liste { list-style: none; padding: 0; margin: 0; }
.dok-liste li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.dok-liste li:last-child { border-bottom: none; }
.notiz {
  background: #fdf6e3; border-radius: 8px; padding: 10px 12px;
  margin-bottom: 10px; font-size: 14px; white-space: pre-line;
}
.notiz .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Lightbox (Dokument-Vorschau mit Vor/Zurück) */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 25, 35, .92);
  display: flex; flex-direction: column;
}
.lb-kopf {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; color: #fff; font-size: 14px;
}
.lb-kopf #lb-titel { font-weight: 600; }
.lb-kopf #lb-zaehler { color: #9fb3c8; }
.lb-kopf .btn { margin-left: auto; }
.lb-kopf .btn + .btn { margin-left: 0; }
.lb-inhalt {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 0 60px 16px;
}
.lb-inhalt img {
  max-width: 100%; max-height: 100%; border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5); background: #fff;
}
.lb-inhalt iframe {
  width: 100%; height: 100%; max-width: 900px; border: none;
  border-radius: 6px; background: #fff;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); color: #fff; border: none;
  font-size: 34px; width: 48px; height: 72px; border-radius: 10px;
  cursor: pointer; z-index: 101;
}
.lb-nav:hover { background: rgba(255,255,255,.3); }
.lb-zurueck { left: 8px; }
.lb-vor { right: 8px; }
@media (max-width: 600px) {
  .lb-inhalt { padding: 0 8px 8px; }
  .lb-nav { width: 38px; height: 56px; font-size: 26px; }
}
.lightbox[hidden] { display: none; }

/* Akquise-CRM eingebettet */
.akquise-frame {
  width: 100%; height: calc(100vh - 280px); min-height: 400px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}

/* Akquise – Heute fällig */
.heute-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.heute-stats-auto {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.heute-stats-compact { margin-top: -4px; }
.heute-stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; text-align: center;
  box-shadow: 0 1px 3px rgba(28,40,51,.06);
  text-decoration: none; color: inherit;
}
.heute-stat:hover { border-color: #c5ced6; text-decoration: none; }
.heute-stat-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); font-weight: 600;
}
.heute-stat b { display: block; font-size: 24px; margin-top: 4px; color: var(--text); }
.heute-stat b a { color: inherit; text-decoration: none; }
.heute-stat-over b { color: var(--err); }
.heute-stat-today b { color: var(--warn); }

.dash-kopf { margin-bottom: 14px; }
.dash-kopf h1 { margin: 0 0 4px; }
.dash-sub { margin: 0; font-size: 13.5px; }
.dash-ruhig { margin: 8px 0 18px; font-size: 14px; }
.dash-block { margin-bottom: 22px; }
.dash-block .section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.heute-section { margin-bottom: 22px; }
.heute-section.heute-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.heute-section-h {
  font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin: 0 0 10px; font-weight: 700;
}
.heute-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 0;
  box-shadow: 0 1px 3px rgba(28,40,51,.06);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
}
.heute-card-top { display: flex; gap: 10px; align-items: flex-start; }
.heute-card-body { flex: 1; min-width: 0; }
.heute-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.heute-firma { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.heute-grund {
  font-size: 13px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.heute-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.heute-more { font-size: 12px; margin: 4px 0 0; }
.heute-empty { text-align: center; padding: 32px 20px; }
.prio {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 99px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; flex-shrink: 0;
}
.prio-ueberfaellig, .prio-err { background: #fadbd8; color: var(--err); }
.prio-heute, .prio-warn { background: #fdebd0; color: var(--warn); }
.prio-woche { background: #eaecee; color: var(--muted); }
.status-dot-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border);
}
.status-dot-pill::before {
  content: ''; width: 7px; height: 7px; border-radius: 999px;
  background: var(--c, var(--muted));
}
@media (max-width: 640px) {
  .heute-stats { grid-template-columns: repeat(2, 1fr); }
  .prio { display: none; }
  .heute-firma { font-size: 15px; }
}

/* Lead-Detail (Akquise-CRM) */
.lead-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.lead-head h1 { margin: 0 0 6px; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  margin-bottom: 16px; padding: 14px 16px; }
.status-quick { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 8px; }
.status-btn {
  border: 1px solid var(--border); border-left: 3px solid var(--c);
  background: #fff; color: var(--text); border-radius: 6px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.status-btn:hover { background: var(--bg); }
.contact-block { border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; background: #fafbfc; }
.contact-label { font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); letter-spacing: .04em; }
.dial-more { margin-top: 6px; }
.dial-more summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.btn-block { width: 100%; margin-top: 4px; text-align: left; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-err { background: #fadbd8; color: var(--err); border: 1px solid #f5b7b1; }
.lead-form textarea { width: 100%; font-family: inherit; }

/* Akquise-Hub */
.akquise-hub {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-top: 8px;
}
.akquise-hub-karte {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 16px; text-decoration: none !important;
  color: var(--text); box-shadow: 0 1px 3px rgba(28,40,51,.06);
  transition: border-color .15s, box-shadow .15s;
}
.akquise-hub-karte:hover {
  border-color: var(--accent); box-shadow: 0 2px 8px rgba(26,82,118,.12);
  text-decoration: none !important;
}
.akquise-hub-karte strong { font-size: 16px; color: var(--text); }
.akquise-hub-karte .muted { font-size: 13px; line-height: 1.4; }
.akquise-hub-icon { font-size: 28px; line-height: 1; }
.akquise-toolbar { flex-wrap: wrap; margin-bottom: 14px; }
.akquise-stats .heute-stat { text-decoration: none; color: inherit; }
.akquise-stats .heute-stat:hover { border-color: var(--accent); }
.akquise-tbl strong { font-weight: 600; }
.callpop {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9999;
  background: #1a5276; color: #fff; border-radius: 12px; padding: 14px 20px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 15px; max-width: 92vw;
  display: flex; align-items: flex-start; gap: 12px;
}
.callpop[hidden] { display: none !important; }
.callpop a { color: #cfe3f0; font-weight: 600; }
.callpop-x {
  background: transparent; border: none; color: #fff; font-size: 18px;
  cursor: pointer; padding: 0; line-height: 1;
}

/* Kalenderwoche – Tooltip per title-Attribut (Hover zeigt z. B. 12.–18.10.2026) */
.kw-badge {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 3px 10px; border-radius: 20px; font-weight: 700;
  font-size: 13px; cursor: help; white-space: nowrap;
}
.kw-badge-lg { font-size: 14px; padding: 4px 12px; }
.badge-sub {
  font-size: 11px; font-weight: 500; opacity: 0.75; vertical-align: middle;
  margin-left: 4px;
}

/* Lieferanten-Bestellungen – ERP-Stil (Pipeline + Meta-Zeile + Anhänge) */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px;
}
.section-head h2 { margin: 0; }
.section-head .muted { margin: 0; }

.best-liste { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.best-karte {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 0; overflow: hidden;
  box-shadow: 0 1px 3px rgba(28, 40, 51, .06);
  border-left: 4px solid var(--border);
}
.best-status-bestellt { border-left-color: var(--warn); }
.best-status-lieferung_erwartet { border-left-color: var(--accent); }
.best-status-geliefert { border-left-color: var(--ok); }

.best-kopf {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 10px; gap: 12px; flex-wrap: wrap;
}
.best-titel { display: flex; align-items: center; gap: 8px; }
.best-lieferant { font-size: 15px; font-weight: 600; color: var(--text); }
.best-nr {
  font-size: 12px; color: var(--muted); background: var(--bg);
  padding: 2px 8px; border-radius: 4px; font-variant-numeric: tabular-nums;
}
.best-rechts { display: flex; align-items: center; gap: 10px; }
.best-betrag { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; border: none; cursor: default;
  white-space: nowrap;
}
.pill-ok { background: #d5f0e0; color: var(--ok); }
.pill-offen {
  background: #fff; color: var(--warn); border: 1px solid #f0d9a8;
  cursor: pointer; font-family: inherit;
}
.pill-offen:hover { background: #fef9ee; }

/* Status-Pipeline (wie Pipedrive / WeClapp) */
.best-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 0 16px 12px; border-bottom: 1px solid var(--border);
}
.best-pipeline {
  display: inline-flex; background: var(--bg); border-radius: 8px;
  padding: 3px; gap: 2px;
}
.best-step {
  position: relative; cursor: pointer; margin: 0;
}
.best-step input { position: absolute; opacity: 0; width: 0; height: 0; }
.best-step span {
  display: block; padding: 5px 12px; font-size: 12px; font-weight: 600;
  color: var(--muted); border-radius: 6px; transition: all .15s;
  white-space: nowrap;
}
.best-step:hover span { color: var(--text); background: rgba(255,255,255,.7); }
.best-step.is-active span {
  background: #fff; color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.best-status-lieferung_erwartet .best-step.is-active span { color: var(--accent); }
.best-status-geliefert .best-step.is-active span { color: var(--ok); }

.best-kw-feld {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto; flex-wrap: wrap;
}
.best-kw-feld label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 0;
}
input.best-kw-input {
  width: 52px; min-width: 52px; max-width: 52px; flex: 0 0 52px;
  padding: 5px 8px; font-size: 13px; font-weight: 600;
  text-align: center; border: 1px solid var(--border); border-radius: 6px;
}
input.best-kw-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(26,82,118,.12); }
.kw-preview {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  flex: 0 0 auto;
}
.best-save {
  width: 28px; height: 28px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--accent);
  font-size: 14px; cursor: pointer; padding: 0; line-height: 1;
}
.best-save:hover { background: var(--bg); border-color: var(--accent); }
.best-geliefert { font-size: 12px; color: var(--muted); }

/* Anhänge-Leiste (wie Gmail / SharePoint) */
.best-anhaenge {
  display: block;
  padding: 10px 16px 14px;
  background: #fafbfc;
  border-top: 1px solid var(--border);
}
.best-anhaenge .section-head { margin-bottom: 4px; }
.best-anhaenge .dok-liste { width: 100%; }
.anhang {
  display: inline-flex; align-items: center;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; max-width: 200px;
}
.anhang-link {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px;
  text-decoration: none; color: var(--text); min-width: 0;
}
.anhang-link:hover { background: #f0f4f8; }
.anhang-icon {
  flex-shrink: 0; font-size: 9px; font-weight: 800; color: #fff;
  background: #c0392b; padding: 4px 5px; border-radius: 4px; letter-spacing: -.02em;
}
.anhang-name {
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.anhang-del {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 0 8px; align-self: stretch;
  border-left: 1px solid var(--border);
}
.anhang-del:hover { color: var(--err); background: #fef5f5; }
.anhang-add {
  border-style: dashed; background: transparent; cursor: pointer;
}
.anhang-add label { cursor: pointer; display: block; padding: 6px 12px; margin: 0; }
.anhang-add-label { font-size: 12px; font-weight: 600; color: var(--accent); }
.anhang-add:hover { border-color: var(--accent); background: #fff; }

@media (max-width: 640px) {
  .best-meta { flex-direction: column; align-items: stretch; }
  .best-kw-feld { margin-left: 0; justify-content: flex-end; }
  .best-pipeline { width: 100%; justify-content: stretch; }
  .best-step { flex: 1; }
  .best-step span { text-align: center; padding: 6px 4px; font-size: 11px; }
}

/* Bestellkarte einklappbar (details/summary) */
details.best-karte > summary {
  list-style: none; cursor: pointer; user-select: none;
}
details.best-karte > summary::-webkit-details-marker { display: none; }
details.best-karte > summary:hover { background: #f7f9fb; }
.best-chevron {
  display: inline-block; font-size: 18px; font-weight: 700;
  color: var(--muted); transition: transform .15s; line-height: 1;
}
details[open] > summary .best-chevron { transform: rotate(90deg); }
.best-anhang-zahl { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Einklappbare Sektionen (Positionen, Dateien) */
.klapp-sektion { margin-bottom: 18px; }
.klapp-sektion .klapp-inhalt { padding: 4px 16px 14px; }
.klapp-sektion .klapp-inhalt h2 { font-size: 14.5px; margin: 16px 0 8px; }

/* Abnahmeprotokoll / Lieferschein – Unterschriften-Pad */
.radio-zeile { display: block; font-size: 15px; color: var(--text); margin: 8px 0; cursor: pointer; }
.radio-zeile input { width: auto; margin-right: 8px; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .sig-grid { grid-template-columns: 1fr; } }
.sig-block { min-width: 0; }
.sig-pad-wrap { position: relative; margin-top: 8px; }
.sig-pad {
  width: 100%; height: 200px; background: #fff; touch-action: none;
  border: 2px dashed var(--border); border-radius: 10px; display: block;
  cursor: crosshair;
}
.sig-clear { position: absolute; top: 8px; right: 8px; }
.sig-hint {
  position: absolute; bottom: 10px; left: 14px; color: var(--muted);
  font-size: 13px; pointer-events: none;
}

/* Auge: geschlossen = Intern, geöffnet = Kundenmodus */
.kundenmodus-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px; margin-right: 10px;
  background: transparent; color: #fff !important; text-decoration: none !important;
  opacity: .85;
}
.kundenmodus-toggle .icon-btn svg { width: 16px; height: 16px; }
.kundenmodus-toggle.an { opacity: 1; }
.kundenmodus-toggle:hover,
.kundenmodus-toggle.an:hover {
  color: #cfe3f0 !important; opacity: 1; text-decoration: none !important;
}

/* Import-Bereich */
.import-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  align-items: start;
}
.import-tool-kopf { display: flex; gap: 12px; align-items: flex-start; }
.import-tool-icon { font-size: 30px; line-height: 1; }
.import-tool-leer {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; border: 2px dashed var(--border); background: transparent;
  min-height: 160px; color: var(--muted);
}
.import-tool-leer .import-tool-icon { opacity: .5; margin-bottom: 8px; }

/* Import-Seite: schicke Upload-Fläche + Tool-Karten */
.import-tool { transition: box-shadow .15s, transform .15s; }
.import-tool:hover { box-shadow: 0 6px 24px rgba(28,40,51,.10); }
.import-tool-icon { font-size: 30px; line-height: 1; }
.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; cursor: pointer;
  border: 2.5px dashed var(--border); border-radius: 12px;
  padding: 26px 16px; background: var(--bg); color: var(--muted);
  font-size: 14px; transition: all .15s; margin: 0;
}
.upload-zone:hover { border-color: var(--accent-light); background: #eef3f7; }
.upload-zone.drag { border-color: var(--accent); background: #e3eef5; color: var(--accent); }
.upload-zone.hat-datei { border-style: solid; border-color: var(--ok); background: #eafaf1; color: var(--ok); }
.upload-zone .upload-icon { font-size: 34px; }
.upload-zone u { color: var(--accent-light); }

/* ——— Auftragscockpit ——— */
.akt-kopf {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px 16px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(28,40,51,.06);
}
.akt-titelzeile {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-start; margin-bottom: 16px;
}
.akt-kicker { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.akt-kicker a { color: var(--muted); }
.akt-h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
.akt-meta { margin: 0 0 2px; font-size: 13.5px; color: var(--muted); }
.akt-aktionen { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.akt-mehr { position: relative; }
.akt-mehr > summary { list-style: none; cursor: pointer; }
.akt-mehr > summary::-webkit-details-marker { display: none; }
.akt-mehr-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 240px; max-width: min(320px, calc(100vw - 24px));
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(28,40,51,.14);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
  max-height: min(70vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.akt-mehr-menu a, .akt-mehr-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border: none; background: none; border-radius: 6px; color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none;
  box-sizing: border-box;
}
.akt-mehr-menu a:hover, .akt-mehr-menu button:hover { background: var(--bg); }
.akt-mehr-menu form { display: flex; flex-direction: column; gap: 6px; padding: 6px 4px; }
.akt-mehr-menu input[type=email],
.akt-mehr-menu input[type=text],
.akt-mehr-menu select { width: 100%; padding: 6px 8px; font-size: 13px; box-sizing: border-box; }
.akt-duplizieren { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px !important; }

.akt-unten { display: grid; grid-template-columns: 1fr; gap: 16px; }
.akt-unten-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) {
  .akt-unten-2 { grid-template-columns: 1fr; }
}
.akt-kw {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 0;
}
.akt-kw-datum { font-size: 14px; font-weight: 600; color: var(--text); }
.akt-menu-hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.akt-menu-danger { color: var(--err) !important; font-weight: 600; }

.akt-timeline {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: stretch;
  gap: 0;
  flex-wrap: nowrap;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  overflow-x: auto;
}
.akt-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 88px;
  cursor: pointer;
  margin: 0;
  position: relative;
}
.akt-step input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.akt-step-dot {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border);
  box-sizing: border-box;
}
.akt-step.is-done .akt-step-dot { background: var(--ok); border-color: var(--ok); }
.akt-step.is-active .akt-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(26,82,118,.15);
}
.akt-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}
.akt-step.is-active .akt-step-label { color: var(--accent); }
.akt-step.is-done .akt-step-label { color: var(--ok); }
.akt-step-line {
  flex: 1 1 24px;
  align-self: flex-start;
  height: 2px;
  min-width: 20px;
  max-width: 80px;
  margin: 6px 4px 0;
  background: var(--border);
  border-radius: 1px;
}
.akt-step-line.is-done { background: var(--ok); }

.akt-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px;
  align-items: start;
}
.akt-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.akt-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 68px; }
.akt-finanz .akt-kpi {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 6px 0;
}
.akt-finanz .akt-kpi .label { font-size: 13px; color: var(--muted); }
.akt-finanz .akt-kpi .wert { font-weight: 700; font-variant-numeric: tabular-nums; }
.akt-hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.akt-finanz-actions {
  display: flex; flex-direction: column; gap: 8px; margin-top: 14px;
}
.akt-finanz-actions .btn {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  display: block;
}
.ang-versand-wrap { margin-top: 0; }
.ang-versand { margin: 0; }
@media (max-width: 960px) {
  .ang-versand-spacer { display: none; }
}

.check-liste { list-style: none; margin: 0; padding: 0; }
.check-liste li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.check-liste li:last-child { border-bottom: none; }
.check-mark {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.check-liste .is-ok .check-mark { background: #d5f0e0; color: var(--ok); }
.check-liste .is-offen .check-mark { background: #f4f6f8; color: var(--muted); border: 1px solid var(--border); }
.check-liste .is-ok { color: var(--muted); }
.check-liste .is-offen { font-weight: 600; }

.tbl-auftraege .amp-status { font-weight: 600; }
.auftrag-row.status-offen td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.auftrag-row.status-bestellt td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.auftrag-row.status-geliefert td:first-child,
.auftrag-row.status-montiert td:first-child { box-shadow: inset 3px 0 0 #6c3483; }
.auftrag-row.status-abgeschlossen td:first-child { box-shadow: inset 3px 0 0 var(--ok); }

.angebot-row.status-entwurf td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.angebot-row.status-versendet td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.angebot-row.status-nachfass td:first-child { box-shadow: inset 3px 0 0 #6c3483; }
.angebot-row.status-angenommen td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.angebot-row.status-abgelehnt td:first-child,
.angebot-row.status-abgelaufen td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.angebot-row.status-ersetzt td:first-child { box-shadow: inset 3px 0 0 var(--muted); }

/* Bestellkarte: Status-Badge auf Mobile nicht abschneiden */
.best-kopf { min-width: 0; }
.best-titel { min-width: 0; flex-wrap: wrap; }
.best-nr, .best-titel .badge {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 640px) {
  .best-kopf { flex-direction: column; align-items: flex-start; gap: 8px; }
  .best-rechts { width: 100%; justify-content: space-between; }
  .best-titel .badge { white-space: nowrap; max-width: none; overflow: visible; }
}

@media (max-width: 960px) {
  .akt-layout { grid-template-columns: 1fr; }
  .akt-side { position: static; order: -1; }
}
@media (max-width: 640px) {
  .akt-kopf { padding: 14px 12px 12px; overflow: visible; }
  .akt-h1 { font-size: 20px; word-break: break-word; }
  .akt-titelzeile { flex-direction: column; gap: 12px; margin-bottom: 12px; }
  .akt-aktionen {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .akt-aktionen > .btn,
  .akt-aktionen > form,
  .akt-aktionen > .akt-mehr {
    width: 100%;
  }
  .akt-aktionen > .btn,
  .akt-aktionen > form .btn,
  .akt-mehr > summary.btn {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
  /* Menü direkt unter dem Button – Button bleibt sichtbar, zweites Tippen schließt */
  .akt-mehr-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    bottom: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: 55vh;
    z-index: 40;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(28,40,51,.16);
  }
  .akt-mehr-menu a,
  .akt-mehr-menu button {
    padding: 11px 12px;
    font-size: 15px;
  }
  .akt-step { min-width: 56px; }
  .akt-step-label { font-size: 10px; }
  .akt-timeline {
    padding: 8px 6px;
    -webkit-overflow-scrolling: touch;
  }
  .akt-finanz .btn { width: 100%; }
  main { padding: 12px; overflow-x: hidden; }
}

/* Bestellungen – KW-Board */
main:has(.best-board) { max-width: none; }
.best-ansicht-switch {
  display: inline-flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; gap: 2px;
}
.best-ansicht-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-radius: 6px; text-decoration: none; line-height: 1.2;
}
.best-ansicht-btn:hover { color: var(--text); text-decoration: none; }
.best-ansicht-btn.is-active {
  background: #fff; color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.best-filter {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 0 0 18px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.best-filter-q {
  flex: 0 1 220px; width: 220px; min-width: 140px; max-width: 220px;
}
.best-filter select {
  flex: 0 0 auto; width: auto; min-width: 0; max-width: 160px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff;
}
.best-filter select[name="lieferant"] { max-width: 150px; }
.best-filter select[name="status"] { max-width: 140px; }
.best-filter input[type=search] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff;
  width: 100%; box-sizing: border-box;
}
.best-filter-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
  flex: 0 0 auto; white-space: nowrap;
}
.best-filter .btn { flex: 0 0 auto; }

.best-ueberfaellig {
  margin: 0 0 18px; padding: 12px 14px;
  background: #fdf2f0; border: 1px solid #f0c4bc; border-radius: 10px;
}
.best-ueberfaellig h2 { margin: 0 0 10px; font-size: 15px; color: var(--err); }
.best-ueberfaellig .best-board-cards {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.best-ueberfaellig .best-mini { width: min(280px, 100%); }

.best-board {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.best-board-col {
  flex: 0 0 280px; width: 280px;
  background: #eef2f5; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px;
  min-height: 120px;
}
.best-board-col.is-aktuell {
  background: #e8f1f8; border-color: #a8c5d8;
  box-shadow: 0 0 0 2px rgba(26,82,118,.12);
}
.best-board-col.is-vergangen { opacity: .92; }
.best-board-col.is-ohne { background: #f7f7f5; }
.best-board-head { margin-bottom: 10px; }
.best-board-head strong { font-size: 14px; }
.best-board-count {
  display: inline-block; margin-left: 6px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,.8); padding: 1px 7px; border-radius: 10px;
}
.best-board-range { font-size: 11px; margin-top: 2px; }
.best-board-cards { display: flex; flex-direction: column; gap: 8px; }
.best-board-empty { margin: 8px 4px; font-size: 12px; }

.best-mini {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  border-left: 3px solid var(--border);
  box-shadow: 0 1px 2px rgba(28,40,51,.05);
  height: 168px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.best-mini.best-status-bestellt { border-left-color: var(--warn); }
.best-mini.best-status-lieferung_erwartet { border-left-color: var(--accent); }
.best-mini.best-status-geliefert { border-left-color: var(--ok); }
.best-mini-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 4px; flex-shrink: 0;
}
.best-mini-lieferant {
  font-weight: 700; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.best-mini-auftrag {
  display: block; font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 2px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.best-mini-auftrag:hover { color: var(--accent); }
.best-mini-nr {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 6px; flex-shrink: 0; min-height: 1.2em;
}
.best-mini-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 6px; flex-shrink: 0; min-height: 24px;
}
.best-mini-betrag { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.best-mini-files {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
  flex: 1 1 auto; min-height: 22px; max-height: 44px; overflow: hidden;
  align-content: flex-start;
}
.best-file-chip {
  font-size: 11px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; color: var(--accent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.best-mini-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: auto; flex-shrink: 0;
}

@media (max-width: 820px) {
  .best-board-col { flex-basis: 260px; width: 260px; }
  .best-filter { padding: 10px; }
}

/* ——— Projekte / Kommunikation ——— */
.proj-mappe { margin: 16px 0 12px; }
.proj-mappe .section-head { margin-bottom: 12px; }
.proj-mappe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.proj-folder {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; text-decoration: none;
  color: var(--text); background: #fff;
  border: 1px solid var(--border, #dde3e8);
  border-left: 3px solid var(--border);
  transition: background .12s, border-color .12s;
}
.proj-folder:hover {
  background: var(--bg); border-color: #c5d0db;
  border-left-color: var(--accent-light); text-decoration: none;
}
.proj-folder.is-active {
  background: rgba(26, 82, 118, .1);
  color: var(--accent);
  border-color: rgba(26, 82, 118, .28);
  border-left-color: var(--accent);
  font-weight: 600;
}
.proj-folder.is-active .muted,
.proj-folder.is-active .proj-ref,
.proj-folder.is-active .proj-folder-stats {
  color: var(--accent-light);
  font-weight: 500;
}
.proj-folder-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.proj-folder-body strong { font-size: 14.5px; }
.proj-folder-body strong { font-size: 14.5px; }
.proj-folder-stats { font-size: 12px; margin-top: 4px; }
.proj-mappe-empty { grid-column: 1 / -1; margin: 4px 0 0; }
.proj-aktiv-hinweis { margin: 8px 0 14px; font-size: 13.5px; }
.toolbar .akt-mehr { display: inline-block; vertical-align: middle; }
.toolbar .akt-mehr-menu { left: 0; right: auto; }
.toolbar .akt-mehr { display: inline-block; vertical-align: middle; }
.toolbar .akt-mehr-menu { left: 0; right: auto; }
.proj-ref { font-size: 11px; opacity: .75; font-family: ui-monospace, monospace; }
.proj-neu summary { cursor: pointer; font-weight: 600; }
.komm-timeline { margin-bottom: 22px; }
.komm-notiz {
  display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 16px;
}
.komm-notiz textarea { flex: 1; min-height: 56px; }
.komm-wa .wa-drop {
  flex: 1; min-width: 200px;
  border: 1.5px dashed transparent; border-radius: 8px;
  padding: 2px; transition: border-color .15s, background .15s;
  position: relative;
}
.komm-wa .wa-drop.drag {
  border-color: var(--accent, #1a5276);
  background: #e8f1f7;
}
.komm-wa .wa-drop.hat-datei {
  border-color: var(--ok, #1a7f37);
  background: #eafaf1;
}
.komm-wa .wa-drop textarea { width: 100%; display: block; box-sizing: border-box; }
.komm-wa .wa-files { font-size: 12px; margin-top: 4px; padding: 0 4px 2px; }
.komm-wa #wa-file {
  display: block; width: 100%; margin-top: 4px; font-size: 12px;
}
.komm-wa .wa-docs {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 2px;
}
.komm-liste { display: flex; flex-direction: column; gap: 8px; }
.komm-eintrag {
  border: 1px solid var(--border, #e2e6ea); border-radius: 8px; background: #fff;
  border-left: 3px solid transparent;
}
.komm-eintrag.komm-whatsapp-thread {
  border-left-color: #25d366;
}
.komm-eintrag.komm-out,
.komm-eintrag.komm-notiz {
  border-left-color: var(--accent, #1a5276);
}
.komm-eintrag.komm-in {
  border-left-color: #9aa7b2;
}
.komm-eintrag > summary {
  cursor: pointer; list-style: none; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.komm-eintrag > summary::-webkit-details-marker { display: none; }
.komm-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.komm-kanal { font-weight: 600; color: var(--text); }
.komm-betreff { font-size: 14px; font-weight: 500; line-height: 1.35; }
.komm-betreff-sub { font-size: 12px; line-height: 1.3; }
.komm-body { padding: 0 12px 12px; border-top: 1px solid var(--border, #eee); }
.komm-text {
  white-space: pre-wrap; font: inherit; font-size: 13.5px;
  margin: 10px 0; background: var(--bg, #f7f8fa); padding: 10px; border-radius: 6px;
}
.komm-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.komm-file-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.komm-import-form { display: inline; margin: 0; }
.komm-actions { margin: 8px 0 4px; }
.komm-zuordnen { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.komm-zuordnen { display: flex; } /* gewinnt gegen form.inline { display:inline } */
.komm-zuordnen select { max-width: 280px; min-width: 140px; flex: 1 1 auto; }
.tbl-aktionen { min-width: 220px; vertical-align: top; }
.tbl-aktionen-zeile { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.tbl-aktionen .komm-zuordnen { margin: 0; }

/* Projekt-Vermerk – Farbe nur am einzelnen Historie-Eintrag */
.vermerk-hist-item {
  padding: 8px 10px;
  margin: 6px 0 0;
  border-radius: 6px;
  border: 1px solid var(--border, #eee);
  font-size: 13px;
  list-style: none;
}
.vermerk-hist-item.vermerk-farbe-gelb {
  background: #fef9e7;
  border-left: 4px solid #f1c40f;
}
.vermerk-hist-item.vermerk-farbe-rot {
  background: #fdedec;
  border-left: 4px solid #e74c3c;
}
.vermerk-hist-item.vermerk-farbe-gruen {
  background: #eafaf1;
  border-left: 4px solid #27ae60;
}
.vermerk-hist-item.vermerk-farbe-orange {
  background: #fef5e7;
  border-left: 4px solid #e67e22;
}
.vermerk-del-form { margin: 0; flex-shrink: 0; }
.vermerk-del-btn { white-space: nowrap; font-size: 12px; padding: 2px 8px; }
.vermerk-farben { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vermerk-farben select,
select.vermerk-ampel {
  width: auto;
  min-width: 0;
  max-width: 7.5rem;
}
.ai-formulieren-draft textarea { width: 100%; }

/* Kommunikation einklappbar */
details.komm-timeline > summary.komm-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  user-select: none;
}
details.komm-timeline > summary.komm-summary::-webkit-details-marker { display: none; }
details.komm-timeline > summary.komm-summary .komm-chevron {
  display: inline-block;
  transition: transform .15s ease;
  color: var(--muted, #889);
  font-size: 14px;
}
details.komm-timeline[open] > summary.komm-summary .komm-chevron { transform: rotate(90deg); }
details.komm-timeline > summary.komm-summary .komm-count,
details.vermerk-box > summary.komm-summary .komm-count {
  font-weight: 400;
  font-size: 13px;
  color: var(--muted, #889);
}
details.vermerk-box > summary.komm-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  user-select: none;
}
details.vermerk-box > summary.komm-summary::-webkit-details-marker { display: none; }
details.vermerk-box > summary.komm-summary .komm-chevron {
  display: inline-block;
  transition: transform .15s ease;
  color: var(--muted, #889);
  font-size: 14px;
}
details.vermerk-box[open] > summary.komm-summary .komm-chevron { transform: rotate(90deg); }

.wa-chat {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; max-height: 380px; overflow-y: auto;
  background: #eef5f0;
}
.wa-empty { margin: 8px 0; text-align: center; }
.wa-thread {
  border-top: 1px solid var(--border, #eee);
}
.wa-composer {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  padding: 10px 12px; background: #fff;
  border-top: 1px solid var(--border, #eee);
}
.wa-composer .wa-snip {
  flex: 1 1 100%; font-size: 13px; padding: 5px 8px;
  border: 1px solid var(--border, #ddd); border-radius: 6px;
  background: #fafafa;
}
.wa-composer .wa-drop {
  flex: 1; min-width: 180px;
  border: 1.5px dashed transparent; border-radius: 8px;
  padding: 2px; transition: border-color .15s, background .15s;
}
.wa-composer .wa-drop.drag {
  border-color: var(--accent, #1a5276);
  background: #e8f1f7;
}
.wa-composer .wa-drop.hat-datei {
  border-color: var(--ok, #1a7f37);
  background: #eafaf1;
}
.wa-composer .wa-drop textarea {
  width: 100%; display: block; box-sizing: border-box; min-height: 52px;
}
.wa-composer .wa-docs {
  max-height: 120px; overflow-y: auto; margin-top: 6px; padding: 2px 0;
}
.wa-composer .wa-files { font-size: 12px; margin-top: 4px; padding: 0 2px; }
.wa-composer #wa-file { display: block; width: 100%; margin-top: 4px; font-size: 12px; }
.wa-composer > .btn { flex: 0 0 auto; margin-top: 4px; }
.wa-verschieben {
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid var(--border, #eee);
}
.wa-msg-zuordnen {
  margin-top: 6px;
  gap: 4px;
}
.wa-msg-zuordnen select {
  max-width: 140px;
  font-size: 11px;
  padding: 2px 4px;
}
.wa-msg-zuordnen .btn { font-size: 11px; padding: 2px 6px; }
.wa-bubble {
  max-width: 85%; padding: 8px 10px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.4; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.wa-bubble.wa-in {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
}
.wa-bubble.wa-out {
  align-self: flex-end;
  background: #d9fdd3;
  border-bottom-right-radius: 4px;
}
.wa-bubble-meta {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; color: var(--muted); margin-bottom: 4px;
}
.wa-bubble-text { white-space: pre-wrap; }
.wa-bubble .komm-files { margin: 6px 0 0; }

.mail-snips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.mail-editor textarea#mail-body { font-family: inherit; line-height: 1.45; }

/* Post-Inbox */
.post-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  margin-bottom: 14px;
}
.post-head h1 { margin: 0; flex: 1; }
.post-suche { display: flex; gap: 8px; align-items: center; }
.post-suche input[type="search"] { min-width: 200px; }
.post-ergebnis.is-loading { opacity: 0.55; pointer-events: none; transition: opacity 0.15s; }
.post-chips, .post-themen {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.post-chip, .post-thema {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--border, #e2e6ea); background: #fff; color: inherit;
  text-decoration: none;
}
.post-chip span, .post-thema span {
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.post-chip.is-on, .post-thema.is-on {
  background: var(--a40, #1a5276); color: #fff; border-color: transparent;
}
.post-chip.is-on span { color: rgba(255,255,255,.85); }
.post-thema { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.post-liste { display: flex; flex-direction: column; gap: 8px; }
.post-zeile-wrap {
  border: 1px solid var(--border, #e2e6ea); border-radius: 8px;
  background: #fff; border-left: 3px solid transparent;
  overflow: hidden;
}
.post-zeile-wrap:hover { border-color: #c5ced6; }
.post-zeile-wrap.is-out:not(.is-antwort) {
  border-left-color: var(--accent, #1a5276);
}
.post-zeile-wrap.is-in:not(.is-antwort) {
  border-left-color: #9aa7b2;
}
/* „Antwort nötig“: gelber Streifen bleibt der Alarm */
.post-zeile-wrap.is-antwort {
  border-left-color: #e0b84a;
}
.post-zeile {
  display: block; text-decoration: none; color: inherit;
  padding: 12px 14px; background: transparent; border: 0;
}
.post-zeile-klar {
  margin: 0; padding: 0 14px 10px;
  display: flex; justify-content: flex-end;
}
.post-zeile.is-antwort { background: transparent; }
.post-zeile-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 2px;
}
.post-nr { font-size: 15px; }
.post-zeit { margin-left: auto; font-size: 12px; }
.post-firma { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.post-vorhaben {
  font-size: 12.5px; color: var(--muted, #5c6570); margin-bottom: 4px;
  line-height: 1.3;
}
.post-auszug {
  font-size: 13.5px; line-height: 1.35; color: var(--text, #222);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center;
}
.post-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eef2f5; color: #445;
}
.post-badge-antwort {
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 4px;
  background: #e0b84a; color: #3d3208;
}
.post-nachfass { font-size: 12px; color: var(--muted); }
.post-nachfass.is-due { color: #a94442; font-weight: 600; }
.post-detail-head {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
  align-items: flex-start; margin-bottom: 16px;
}
.post-detail-head h1 { margin: 0; }
.post-aktionen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.post-nachfass-form { margin-bottom: 16px; padding: 12px 14px; }
.post-nachfass-form label { display: block; margin-bottom: 6px; font-size: 13px; }
.post-nachfass-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.post-nachfass-row input[type="date"] { max-width: 180px; }
.post-thread .komm-eintrag.is-antwort {
  border-left: 3px solid #e0b84a;
}
@media (max-width: 640px) {
  .post-suche { width: 100%; }
  .post-suche input[type="search"] { flex: 1; min-width: 0; }
}

/* Mail-Modal am Auftrag */
.a40-mail-modal {
  border: none; border-radius: 10px; padding: 0;
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.a40-mail-modal::backdrop { background: rgba(20,30,40,.45); }
.a40-mail-modal form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.a40-mail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.a40-mail-head h2 { margin: 0; font-size: 18px; }
.a40-mail-body {
  padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 6px;
}
.a40-mail-body label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.a40-mail-body input, .a40-mail-body select, .a40-mail-body textarea {
  width: 100%;
}
.a40-mail-anhaenge { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.a40-mail-anhang-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.a40-mail-anhang-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}
.a40-mail-anhang-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 500;
}
.a40-mail-anhang-chip.is-missing {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 13px;
}
.a40-mail-foot {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border);
}

/* Reklamation */
.rekl-banner {
  border-left: 3px solid var(--warn, #b9770e);
  margin-bottom: 14px;
}
.rekl-zeile {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-top: 1px solid var(--border, #eee);
}
.rekl-banner .rekl-zeile:first-of-type,
.rekl-liste .rekl-zeile:first-child { border-top: 0; padding-top: 0; }
.rekl-zeile.is-offen { }
.rekl-liste { margin-top: 12px; }
.rekl-form textarea { width: 100%; min-height: 56px; }
.rekl-form-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 8px; justify-content: space-between;
}
.rekl-form-row input[type="file"] { display: block; margin-top: 4px; font-size: 12px; }

