:root {
  --bg: #f5f2ec;
  --card: #fffdfa;
  --text: #1f1e1b;
  --muted: #7b766d;
  --line: #d7d0c5;
  --soft: #ded6ca;
  --soft-strong: #cfc4b5;

  /* ── Rückmeldemaske ────────────────────────────────────────────────────
     Die Maske liegt in `runtime/rueckmeldung/` und gehört keinem Organ. Sie
     trägt die FUNKTION; das Aussehen kommt von hier. Ohne diese neun Werte
     fiele sie auf die Farben des Trader-Cockpits zurück — dunkel, auf
     warmem Papier. Der Namensraum ist der Vertrag, siehe den Kopf von
     `rueckmeldung.js`. */
  --rueck-flaeche: var(--card);
  --rueck-flaeche2: #f2eee6;
  --rueck-linie: var(--line);
  --rueck-schrift: var(--text);
  --rueck-still: var(--muted);
  --rueck-akzent: #8a6d3b;          /* gebranntes Ocker, aus der Haus-Palette */
  --rueck-auf-akzent: #fffdfa;      /* auf dunklem Ocker helle Schrift */
  --rueck-senden: #5c7a4a;          /* gedecktes Grün statt Signalgrün */
  --rueck-auf-senden: #fffdfa;
  --rueck-warn: #a4443a;
  --rueck-schatten: rgba(58, 48, 34, .16);
  --rueck-abdunkler: rgba(58, 48, 34, .34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.hero {
  margin-bottom: 20px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3.5vw, 40px);
  font-weight: 400;
  /* War -0.045em: bei 40px sind das 1,8px NEGATIV je Abstand — Buchstaben
     schieben sich ineinander, „Geschäftsjahre" wird zum Klumpen. Simon hat
     es mehrfach gemeldet. Jetzt leicht offen statt eng. */
  letter-spacing: 0.01em;
}

h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 400;
}

.action {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.action:hover {
  background: #f0ede8;
}

.action.primary {
  background: var(--soft);
  border-color: var(--soft-strong);
  font-weight: 600;
}

.action.secondary {
  color: var(--muted);
}

.action.danger {
  color: #b33;
  border-color: #ecc;
}

.action.danger:hover {
  background: #fef0f0;
}

.metrics {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.metrics article {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.58);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metrics strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  font-weight: 400;
  /* Zahlen brauchen Luft, nicht Enge — hier standen -0.03em. */
  letter-spacing: 0.005em;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  min-height: 260px;
}

.panel-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-subhead {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.activity {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.activity:last-child {
  border-bottom: none;
}

.activity strong,
.activity span,
.activity small {
  display: block;
}

.activity span {
  margin-top: 5px;
}

.activity small {
  margin-top: 5px;
  color: var(--muted);
}

.activity-right {
  text-align: right;
  white-space: nowrap;
}

.activity-right em {
  display: inline-block;
  margin-top: 6px;
  font-style: normal;
  font-size: 13px;
}

.ok { color: #526f47; }
.warn { color: #9a6522; }

.empty {
  color: var(--muted);
}

.task-list {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.task-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.task-main {
  display: grid;
  gap: 6px;
}

.task-main strong,
.task-main small {
  display: block;
}

.task-main small {
  color: var(--muted);
  line-height: 1.35;
}

.task-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.priority {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #9aad8d;
  border-radius: 6px;
  color: #526f47;
  font-style: normal;
  font-size: 12px;
  white-space: nowrap;
}

.priority.high {
  border-color: #c79463;
  color: #9a6522;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.compact-task-list .task-card {
  padding-bottom: 12px;
}

@media (max-width: 860px) {
  .actions,
  .metrics,
  .grid {
    grid-template-columns: 1fr;
  }
}

.doc-link {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255,255,255,.52);
  text-decoration: none;
  font-size: 12px;
}

.doc-link:hover {
  border-color: var(--soft-strong);
  background: var(--soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.offer-form {
  display: grid;
  gap: 18px;
}

.context-line {
  margin: 12px 0 0;
  color: var(--muted);
}

.small-context {
  margin-top: 6px;
  font-size: 14px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.compact-grid {
  grid-template-columns: 1fr minmax(180px, .32fr);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefa;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(82, 111, 71, .22);
  border-color: #8fa282;
}

textarea {
  resize: vertical;
}

.mail-grid {
  grid-template-columns: minmax(240px, .55fr) 1fr;
}

.mail-layout {
  grid-template-columns: .95fr 1fr 1fr;
}

.mail-capture {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.proof-upload {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.order-summary strong {
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.order-grid {
  grid-template-columns: .9fr 1.15fr .95fr .95fr;
}

.flow-panel {
  margin-bottom: 18px;
}

.next-step {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding-top: 16px;
}

.flow-step {
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.42);
}

.flow-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
}

.flow-step strong {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.25;
}

.flow-step.done {
  border-color: #9aad8d;
  background: #f2f7ee;
}

.flow-step.done span {
  border-color: #9aad8d;
  color: #526f47;
}

.timeline-panel {
  min-height: 360px;
}

.timeline {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.timeline-item {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-item strong,
.timeline-item span,
.timeline-item small {
  display: block;
}

.timeline-item span,
.timeline-item small,
.link-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.timeline-item p {
  margin: 0;
  line-height: 1.45;
}

.link-list {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.link-row {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.link-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.attachment-line {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #9aad8d;
  border-radius: 9px;
  background: #f2f7ee;
  color: #526f47;
}

.notice p {
  margin: 0;
}

.notice--success {
  border-color: #3a7d4a;
  background: #e6f3e9;
  color: #1f5a2e;
}

.notice--error {
  border-color: #c94a4a;
  background: #fdeaea;
  color: #8a2e2e;
}

/* ── Flash-Meldungen (flash / flash-success / flash-error) ───────────────
   Nachgezogen 27.07.2026: mehrere Templates (discovery_review,
   discovery_job_new, discovery_jobs, Bewerbungen) geben Flash-Meldungen mit
   diesen Klassen aus, im Stylesheet fehlten sie jedoch komplett — die
   Meldungen erschienen als unformatierter Text. Optik bewusst identisch zu
   .notice, damit das ERP einheitlich bleibt. */
.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #9aad8d;
  border-radius: 9px;
  background: #f2f7ee;
  color: #526f47;
  font-size: 14px;
}

.flash-success {
  border-color: #3a7d4a;
  background: #e6f3e9;
  color: #1f5a2e;
}

.flash-error {
  border-color: #c94a4a;
  background: #fdeaea;
  color: #8a2e2e;
}

.safety-notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #c79463;
  border-radius: 9px;
  background: #fff6ed;
  color: #784710;
}

.safety-notice p {
  margin: 0;
}

.disabled-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255,255,255,.35);
  font-size: 14px;
  white-space: nowrap;
}

.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.items-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.panel-head.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.small-button,
.submit-button {
  border: 1px solid var(--soft-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--soft);
  cursor: pointer;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.item-table {
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.item-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.1fr) minmax(260px, 1.35fr) minmax(88px, .42fr) minmax(110px, .48fr);
  gap: 10px;
  align-items: center;
}

.item-head.invoice-head,
.item-row.invoice-row {
  grid-template-columns: minmax(210px, 1.1fr) minmax(260px, 1.35fr) minmax(88px, .42fr) minmax(110px, .48fr) minmax(72px, .32fr);
}

.item-head {
  color: var(--muted);
  font-size: 13px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255,255,255,.5);
  font-size: 13px;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.submit-button {
  min-height: 44px;
  padding: 0 16px;
}

.error-list {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #c79463;
  border-radius: 9px;
  background: #fff6ed;
  color: #784710;
}

.error-list p {
  margin: 0;
}

@media (max-width: 980px) {
  .form-grid,
  .compact-grid,
  .mail-grid,
  .mail-layout,
  .order-grid,
  .flow-steps,
  .item-head,
  .item-row,
  .item-head.invoice-head,
  .item-row.invoice-row {
    grid-template-columns: 1fr;
  }

  .item-head {
    display: none;
  }

  .item-row {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }

  .item-row:last-child {
    border-bottom: none;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 34px 16px;
  }

  .page-head,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .back-link,
  .submit-button,
  .small-button,
  .disabled-action,
  .header-actions {
    justify-content: center;
    width: 100%;
  }
}

/* ── Customer Search (AJAX) ─────────────────────────────────── */
.customer-search-wrapper {
  position: relative;
}

#customer-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}

#customer-search.is-selected {
  border-color: #4a8a4a;
  background: #f0f8f0;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  max-height: 320px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f0edf0;
}

.search-result-item strong {
  font-size: 14px;
}

.search-result-item small {
  font-size: 12px;
  color: var(--muted);
}

.search-result-item.empty {
  cursor: default;
  color: var(--muted);
  font-size: 13px;
}

.search-result-item.empty a {
  color: var(--text);
  text-decoration: underline;
}

/* ── Data Table ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft);
  font-size: 14px;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #faf7f3;
}

.cell-actions {
  white-space: nowrap;
  text-align: right;
}

.cell-actions .doc-link {
  margin-left: 8px;
}

/* ── Data List (definition list) ───────────────────────────── */
.data-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 12px;
}

.data-list dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 8px 0;
}

.data-list dd {
  margin: 0;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Search Form ───────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  background: var(--card);
}

/* ── Tab Bar ────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  background: var(--card);
  border-radius: 8px 8px 0 0;
  padding: 0 4px;
  position: relative;
}

.tab-group {
  display: flex;
  gap: 2px;
}

.tab {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}

.tab-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tab-action {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--soft-strong);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

/* Angemeldete Identität in der Aktionsleiste: dezent, kein Knopf. Führt zum
   Kennwort-Ändern. */
.tab-user {
  display: inline-block;
  padding: 6px 4px 6px 12px;
  font-size: 12px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  margin-left: 4px;
  text-decoration: none;
}
.tab-user:hover { color: var(--text); }

.tab-action:hover {
  background: var(--soft-strong);
}

/* ── Nav Dropdown (Fadeout-Submenü, Menüzeile-Aufräumen) ──────── */
/* Jede .nav-group ist ein Top-Level-Menüpunkt mit optionalem
   Fadeout-Dropdown darunter - rein CSS (:hover/:focus-within), damit
   auch Bereiche wie Scout Tracker/Kanban/Postausgang erreichbar sind,
   ohne die Kopfzeile mit Einzel-Links zu ueberladen. */
.nav-group {
  position: relative;
}

.nav-group.active > .tab {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}

.nav-group .tab {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-caret {
  font-size: 9px;
  opacity: .6;
  transform: translateY(1px);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
  box-shadow: 0 10px 24px rgba(31,30,27,0.10);
  padding: 6px 0;
  margin-top: 1px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 60;
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  background: #f0ede8;
}

.nav-dropdown-item.active {
  font-weight: 600;
  color: var(--text);
}

/* ── Nav-Link (schlichter Navigations-Link ohne Box/Unterstrich) ──
   Fuer reine Seitenwechsel-Links (z.B. "Mail versenden", "Tracking
   Console", "Details") - im Unterschied zu echten Formular-Aktionen
   (.submit-button/.action als <button>), die weiterhin wie Buttons
   aussehen sollen. */
.nav-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 2px 0;
  border: none;
  background: none;
}

.nav-link:hover {
  color: var(--text);
}


/* ── Modal (Task-Termin) ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.35);
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  min-width: 340px;
  max-width: 480px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.modal-box h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
}

.modal-box label {
  display: block;
  margin-bottom: 12px;
}

.modal-box label span {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--muted);
}

.modal-box input,
.modal-box textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Task Status Badge ─────────────────────────────────────── */
.task-status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--soft);
  color: var(--muted);
  margin-left: auto;
  text-transform: lowercase;
}

/* ── Task Done Button ──────────────────────────────────────── */
.task-done-btn {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  background: #e6f3e9;
  border: 1px solid #b8d9c2;
  border-radius: 4px;
  color: #3a7d4a;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.task-done-btn:hover {
  background: #d0ebd6;
  border-color: #8fc8a0;
}

/* ── Task Checklist ─────────────────────────────────────────── */
.task-checklist {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.checklist-item {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.checklist-box {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  color: var(--muted);
  font-family: inherit;
}

.checklist-box.checked {
  color: #4a8a4a;
}

.checklist-text {
  font-size: 12px;
  color: var(--text);
}

.checklist-text.done {
  color: var(--muted);
  text-decoration: line-through;
}

/* ── Inline Form ───────────────────────────────────────────── */
.inline-form {
  display: inline;
}

.link-delete {
  background: none;
  border: none;
  color: #b33;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

.link-delete:hover {
  color: #d44;
}

/* ── Hero Actions ──────────────────────────────────────────── */
.hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

/* ── Count badge ───────────────────────────────────────────── */
.count {
  font-size: 13px;
  color: var(--muted);
  background: var(--soft);
  padding: 2px 10px;
  border-radius: 12px;
}

/* ── Locked hint tooltip ───────────────────────────────────── */
.locked-hint {
  position: relative;
}

.locked-hint::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #1f1e1b;
  color: #fffdfa;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.locked-hint:hover::after {
  opacity: 1;
}

/* ── Field hint ────────────────────────────────────────────── */
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field-hint a {
  color: var(--text);
  text-decoration: underline;
}

/* ── Loading Overlay (Chat-Offerte) ────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(31, 30, 27, 0.55);
  align-items: center;
  justify-content: center;
}

.loading-overlay.open {
  display: flex;
}

.loading-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 40px;
  min-width: 280px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  display: grid;
  gap: 12px;
  justify-items: center;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--soft);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-box strong {
  font-size: 16px;
  font-weight: 600;
}

.loading-box span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Chat-Offerte ──────────────────────────────────────────── */

.chat-form {
  display: grid;
  gap: 18px;
}

.chat-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.chat-label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chat-panel textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffefa;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.chat-panel textarea:focus {
  outline: 2px solid rgba(82, 111, 71, .22);
  border-color: #8fa282;
}

.chat-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.chat-result {
  margin-bottom: 20px;
}

.chat-result h2 {
  margin: 6px 0 14px;
  font-size: 22px;
}

.result-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 16px;
}

.result-details span {
  font-size: 14px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-tips {
  margin-top: 20px;
}

.chat-tips .panel h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--muted);
}

.tip-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tip-example {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.42);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tip-example:hover {
  border-color: var(--soft-strong);
  background: var(--soft);
}

.tip-example pre {
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text);
}

@media (max-width: 700px) {
  .tip-list {
    grid-template-columns: 1fr;
  }
}

/* ─── Scout Cockpit ──────────────────────────────────────────────────── */

.scout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}


.scout-player-card {
  display: flex;
  flex-direction: column;
}

.scout-player-meta {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

.scout-player-meta p {
  margin: 2px 0;
}

.scout-player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.scout-player-actions .submit-button,
.scout-player-actions .back-link {
  font-size: 13px;
  padding: 6px 12px;
}

.scout-campaigns {
  border-top: 1px solid var(--line);
}

.scout-campaigns summary {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.scout-campaigns summary:hover {
  color: var(--text);
}

.scout-campaigns .activity-list {
  padding: 0 16px 12px;
}

.scout-campaigns .activity {
  font-size: 13px;
}

/* ─── Mail-Status-Farben ──────────────────────────────────────────────── */

.status-ok {
  color: #3a7d4a;
  font-weight: 500;
}

.status-warn {
  color: #b8860b;
  font-weight: 500;
}

.success-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 6px;
  background: #e6f3e9;
  color: #3a7d4a;
  font-size: 14px;
  font-weight: 500;
}

.info-badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 6px;
  background: #e8f0fe;
  color: #1a5bb5;
  font-size: 14px;
  font-weight: 500;
}

.error-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #c0392b;
}

.activity-list .activity .ok {
  color: #3a7d4a;
  font-weight: 500;
}

.activity-list .activity .warn {
  color: #b8860b;
  font-weight: 500;
}

.activity-list .activity .error {
  color: #c0392b;
  font-weight: 500;
}

/* Adressbuch: Rollen-Badges (Kunde / Scout-Zielverein) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  background: #eef3ee;
  color: #3a7d4a;
  border: 1px solid #cfe0cf;
}
/* Zustands-Chips: offen traegt Farbe, abgeschlossen ist zurueckgenommen.
   Simon: „abgeschlossen und offen duerfen nicht die gleiche farbe besitzen.
   abgeschlossen muesste ausgegraut sein. gruen ausgegraut denn es ist ja
   nichts haengig oder fehlerhaft." — also kein Rot, kein Warnton: dasselbe
   Gruen, nur entsaettigt. Gesperrt geht einen Schritt weiter. */
.badge-offen {
  background: #eaf3ea;
  color: #2f6b3c;
  border-color: #c3d9c4;
}
.badge-abgeschlossen {
  background: #f2f1ee;
  color: #7f8a7f;
  border-color: #ddddd6;
}
.badge-gesperrt {
  background: #efedea;
  color: #8a8378;
  border-color: #d8d3c9;
  font-style: italic;
}

.badge-customer {
  background: #eef1f7;
  color: #3a5a8a;
  border-color: #cfd8ea;
}

/* ── Mailansicht ────────────────────────────────────────────────────────
   Eine übernommene HTML-Mail wird in einem abgeriegelten Rahmen gezeigt:
   fremdes HTML darf die Oberfläche nicht verändern und nicht nachladen. */
.mail-view-frame {
  width: 100%;
  min-height: 22rem;
  border: 1px solid var(--line, #d9d3c7);
  border-radius: 4px;
  background: #fff;
}
.mail-view-plain { margin-top: .75rem; }
.mail-view-plain summary { cursor: pointer; color: var(--muted, #7a7266); }
.mail-thread { margin-top: 1.5rem; }
.mail-thread h3 { font-size: .95rem; margin-bottom: .4rem; }
.mail-thread ul { list-style: none; padding: 0; margin: 0; }
.mail-thread li { padding: .3rem 0; border-top: 1px solid var(--line, #ece7dd); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* Anhänge: technische Beilagen leiser, aber nicht versteckt. */
.anhang-liste { list-style: none; padding: 0; margin: .3rem 0 0; }
.anhang-liste li { padding: .25rem 0; }
.anhang-technisch { opacity: .55; }

/* ── Rückmeldungen ──────────────────────────────────────────────────────
   Der Zustand ist links am Rand ablesbar, ohne Text: neu trägt Farbe,
   erledigt tritt zurück. „Abgehakt" heisst gelesen, nicht behoben. */
.meldung { border-left: 3px solid transparent; }
.meldung-neu { border-left-color: #b8860b; }
.meldung-gelesen { border-left-color: #8a8578; }
.meldung-erledigt { border-left-color: #6b8e5a; opacity: .72; }
.meldung-text { white-space: pre-wrap; margin: .5rem 0; }
.anhang-bilder { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.anhang-bilder img { max-height: 190px; border: 1px solid var(--line, #ddd);
                     border-radius: 4px; }
.zusammenhang { display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem;
                font-size: .84rem; color: var(--muted, #7a7266); margin: .4rem 0; }
.zusammenhang dt { font-weight: 600; }
.spuren pre { font-size: .78rem; overflow-x: auto; background: rgba(0,0,0,.04);
              padding: .5rem; border-radius: 4px; }
.faden { margin-top: .8rem; border-top: 1px solid var(--line, #ece7dd);
         padding-top: .6rem; }
.wortmeldung { margin: .4rem 0; padding-left: .7rem;
               border-left: 2px solid var(--line, #ece7dd); }
.wortmeldung-melder { border-left-color: #b8860b; }
.meldung-aktionen { display: flex; gap: .5rem; align-items: center;
                    margin-top: .7rem; flex-wrap: wrap; }
.filterleiste { display: flex; gap: .4rem; margin: .8rem 0; }
.filter { padding: .25rem .7rem; border-radius: 3px; text-decoration: none;
          color: var(--muted, #7a7266); }
.filter.aktiv { background: rgba(0,0,0,.06); color: inherit; }
.hinweis-leise { font-size: .84rem; color: var(--muted, #7a7266);
                 border-left: 2px solid #b8860b; padding-left: .7rem;
                 margin: .8rem 0; }

/* ── Klappfeld ──────────────────────────────────────────────────────────
   Für Funktionen, die essenziell, aber selten sind — eine Jahreseröffnung
   macht man einmal im Jahr und braucht dafür kein ganzes Feld. Versteckt
   wird nichts: die Zeile steht sichtbar da, ein Klick öffnet sie. */
details.klappfeld {
  padding: 0;
  /* `.panel` erzwingt min-height — zugeklappt blieben trotzdem 260px
     Leerraum stehen, also genau das, was hier weg sollte. */
  min-height: 0;
}
details.klappfeld > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
details.klappfeld > summary::-webkit-details-marker { display: none; }
details.klappfeld > summary::before {
  content: "+";
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
}
details.klappfeld[open] > summary::before { content: "–"; }
details.klappfeld > summary:hover { background: rgba(0, 0, 0, .02); }
details.klappfeld > *:not(summary) { padding: 0 18px; }
details.klappfeld > form { padding-bottom: 16px; }

/* ── Prüfansicht für Buchungsentwürfe ───────────────────────────────────
   Die Hinweise sind der Kern: sie benennen die Annahmen des Imports. Drei
   Grade, damit man sie nicht gleich behandelt — eine Sperre ist etwas
   anderes als eine Information. */
.pruef-stand { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; }
.pruef-hinweis {
  border-left: 3px solid var(--line);
  padding: .5rem .8rem;
  margin: .5rem 0;
  font-size: .88rem;
  background: rgba(0, 0, 0, .015);
}
.pruef-hinweis strong { display: block; margin-bottom: .15rem; }
.pruef-sperre   { border-left-color: #a4443a; }
.pruef-pruefen  { border-left-color: #b8860b; }
.pruef-annahme  { border-left-color: #8a6d3b; }
.pruef-info     { border-left-color: #8a8578; color: var(--muted); }
.pruef-aktionen {
  display: flex; gap: .6rem; align-items: center;
  flex-wrap: wrap; margin-top: 1rem;
}
.pruef-blaettern { margin-left: auto; display: flex; gap: .5rem; }
.action-primary {
  background: #5c7a4a; color: #fffdfa; border: none;
  border-radius: 4px; padding: .5rem 1.1rem; font-weight: 600; cursor: pointer;
}
.action-primary[disabled] { opacity: .45; cursor: not-allowed; }

/* ── Wer bewirbt sich hier? (05.08.2026) ───────────────────────────────────
   Der Bewerbungs-Assistent bedient seit heute mehrere Personen. Solange es
   nur eine gab, war die Frage „an wessen Lebenslauf arbeite ich gerade?"
   nicht zu stellen — ab der zweiten ist sie die wichtigste auf der Seite.
   Darum steht sie oben, vor allem anderen, und nicht in einer Fusszeile. */
.person-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--soft-strong);
  border-left: 3px solid var(--soft-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, .55);
}
.person-label { color: var(--muted); font-size: 13px; margin-right: 6px; }
.person-wer strong { font-size: 15px; }
.person-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.person-form select { min-width: 190px; min-height: 36px; }
