/* bestfortravel Group - Agenturverwaltung
 * Offizielles CI bestfortravel Group 2024 — Baloo 2 + Navy + Teal
 */

@font-face {
  font-family: "Baloo 2";
  src: url("/static/fonts/Baloo2-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("/static/fonts/Baloo2-Medium.ttf") format("truetype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("/static/fonts/Baloo2-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("/static/fonts/Baloo2-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("/static/fonts/Baloo2-ExtraBold.ttf") format("truetype");
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  /* Primärfarbe: Navy aus bestfortravel-Wortmarke 2024 */
  --accent: #1c2e5e;
  --accent-hover: #142547;
  --accent-soft: #e3e8f1;
  --accent-deep: #0f1d3d;
  --accent-bright: #2ba6a1;       /* Teal aus dem Droplet-Verlauf */
  --accent-bright-hover: #1f8a86;
  --accent-gradient: linear-gradient(135deg, #2ba6a1 0%, #1c2e5e 100%);

  /* Status-Farben */
  --ok: #426e34;              /* GEO-Grün */
  --ok-soft: #e6efe1;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --info: #0369a1;
  --info-soft: #e0f2fe;

  /* Neutrals */
  --bg: #f5f7f9;
  --bg-alt: #ffffff;
  --bg-dark: #0f172a;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;

  /* Radii + Shadows */
  --r: 10px;
  --r-sm: 6px;
  --r-lg: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 4px 24px rgba(15,23,42,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Baloo 2", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  font-weight: 400;
  overflow-x: hidden;  /* kein horizontales Scrollen — Cards passen sich an */
}
/* Container/Main begrenzt — verhindert Overflow durch lange Inhalte */
main, .content, .container { max-width: 100%; min-width: 0; }
.card { min-width: 0; }
.card > * { min-width: 0; }
/* Inline-style title in dashboard-Listen — ellipsis erzwingen */
.data-list-item .title,
.data-list-item .title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.row { min-width: 0; }
.row > * { min-width: 0; }
/* Bulk-Selection in Tabellen */
tr.bulk-selected { background: #eff6ff !important; }
tr.bulk-selected td { border-top-color: #bfdbfe; }
input.bulk-row-check { width: 16px; height: 16px; cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; color: var(--muted); font-weight: 500; }
p { margin: 6px 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* === Topbar === */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  flex-wrap: wrap;
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--text); font-size: 15px;
}
.topbar .brand img { height: 30px; width: auto; }
.topbar .brand .sub { color: var(--muted); font-weight: 500; font-size: 13px; }
.topbar .search { display: none; }

/* === Topbar-Suche (breit zwischen Department und Nav) === */
.topbar-search {
  position: relative; display: flex; align-items: center; gap: 10px;
  flex: 1 1 auto; min-width: 280px; max-width: 720px;
  margin: 0 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 12px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.topbar-search:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar-search .icon { color: var(--muted); flex-shrink: 0; }
.topbar-search input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  padding: 7px 0; font-size: 13.5px; color: var(--text);
}
.topbar-search input::placeholder {
  color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-kbd {
  font-family: ui-monospace, monospace; font-size: 11px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px; color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
@media (max-width: 1200px) {
  .search-kbd { display: none; }  /* bei schmalem Screen ohne Tastatur-Hinweis */
  .topbar-search { min-width: 200px; }
}
.topbar .search input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.topbar .search input:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(28,46,94,.13);
}
.topbar .search .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none;
}
.topbar .nav { display: flex; align-items: center; gap: 4px; }
.topbar .nav a {
  padding: 8px 12px; border-radius: 8px;
  color: var(--text); font-weight: 500; font-size: 13.5px;
  display: flex; align-items: center; gap: 6px;
}
.topbar .nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar .nav a.active { background: var(--accent-soft); color: var(--accent); }
.topbar .nav a .badge { background: var(--err); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; }
.topbar .bell { position: relative; cursor: pointer; padding: 8px; border-radius: 8px; }
.topbar .bell:hover { background: var(--surface-2); }
.topbar .bell .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); display: none; }
.topbar .bell.has-news .dot { display: block; }
.topbar .bell .count {
  position: absolute; top: 0; right: 0;
  background: var(--err); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
  min-width: 16px; text-align: center;
  border: 2px solid var(--surface);
  line-height: 1;
}
.notif-filter { font-size: 12px; padding: 4px 10px; }
.notif-filter.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.notif-panel .item.unread { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.notif-panel .item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-panel .item:hover { background: var(--surface-2); }
.notif-panel .item .ttl { font-weight: 600; }
.notif-panel .item .msg { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-panel .item .meta { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.topbar .nav-divider { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }

/* === Department-Switcher === */
.dept-switcher { position: relative; }
.dept-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer; font-weight: 600; font-size: 13px;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(15,23,42,.12);
  transition: filter .15s, transform .12s;
}
.dept-chip:hover { filter: brightness(1.06); transform: translateY(-1px); }
.dept-chip:focus { outline: 2px solid rgba(255,255,255,.55); outline-offset: 1px; }
.dept-chip-static { cursor: default; }
.dept-chip-static:hover { filter: none; transform: none; }
.dept-chip .dept-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.85); display: inline-block;
}
.dept-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  min-width: 240px; padding: 6px; z-index: 200;
  animation: fadeIn .12s ease;
}
.dept-menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-sm);
  background: transparent; border: none; cursor: pointer;
  color: var(--text); font-weight: 500; font-size: 13.5px;
  font-family: inherit; text-align: left;
  transition: background .12s;
}
.dept-menu-item:hover { background: var(--surface-2); }
.dept-menu-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dept-menu-item .dept-dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block; flex: 0 0 12px;
}
.dept-menu-item svg { margin-left: auto; color: var(--accent); }

/* === User-Menü === */
.user-menu { position: relative; margin-left: 4px; }
.user-chip {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  border: 2px solid var(--surface); cursor: pointer;
  font-weight: 700; font-size: 12.5px; letter-spacing: .04em;
  font-family: inherit; text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(15,23,42,.15);
  transition: transform .12s;
}
.user-chip:hover { transform: scale(1.06); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  min-width: 260px; padding: 6px; z-index: 200;
  animation: fadeIn .12s ease;
}
.user-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-head .user-name { font-weight: 700; color: var(--text); font-size: 14px; }
.user-head .user-email { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-head .user-roles { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.user-head .user-roles .pill { font-size: 10px; padding: 1px 7px; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--text); font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  background: transparent; border: none; cursor: pointer;
  width: 100%; text-align: left; font-family: inherit;
  transition: background .12s;
}
.user-dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.user-dropdown-item.user-logout { color: var(--err); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.user-dropdown-item.user-logout:hover { background: var(--err-soft); }

/* === Tab-Buttons === */
.tab-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 10px 16px; font-weight: 600; font-size: 13.5px;
  color: var(--muted); border-bottom: 3px solid transparent;
  font-family: inherit; transition: color .12s, border-color .12s;
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .pill { margin-left: 6px; }

/* Generic helpers used in templates */
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.text-muted { color: var(--muted); }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mono { font-family: 'SFMono-Regular', 'Consolas', monospace; }
.callout { padding: 12px 14px; border-radius: var(--r); margin: 8px 0; }
.callout.warn { background: var(--warn-soft); border-left: 4px solid var(--warn); color: #92400e; }
.callout.err { background: var(--err-soft); border-left: 4px solid var(--err); color: #991b1b; }
.callout.ok { background: var(--ok-soft); border-left: 4px solid var(--ok); }
.callout.info { background: var(--info-soft); border-left: 4px solid var(--info); }
.loader {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  padding: 40px 20px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--r);
}
/* (alte search-results-Definition entfernt — siehe später unten für aktuelle Variante mit 640px Fixbreite) */
.live-status {
  position: fixed; bottom: 18px; left: 18px; z-index: 80;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
  min-width: 240px; max-width: 320px; font-size: 12.5px;
}
.live-status .head {
  padding: 8px 12px; display: flex; align-items: center; gap: 8px;
  cursor: pointer; border-bottom: 1px solid var(--border);
}
.live-status .head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.live-status.warn .head .dot { background: var(--warn); }
.live-status.err .head .dot { background: var(--err); animation: lsPulse 1.2s infinite; }
.live-status.err { border-color: var(--err); }
.live-status.err .head { color: var(--err); font-weight: 600; }
@keyframes lsPulse { 0%,100% { opacity:1; } 50% { opacity:.35; } }
.live-status.collapsed .body { display: none; }
.live-status .body { padding: 8px 12px; }
.notif-panel {
  position: fixed; top: 68px; right: 18px; z-index: 80;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  width: 340px; max-height: 500px; overflow-y: auto;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel .head {
  padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.notif-panel .head .spacer { flex: 1; }
.close-x { cursor: pointer; padding: 0 6px; font-size: 18px; color: var(--muted); }
.close-x:hover { color: var(--text); }
.modal { padding: 0; }
.modal .head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal .body { padding: 16px 18px; }
.modal .foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal.wide { max-width: 880px; }
.ai-suggestion {
  background: linear-gradient(135deg, #f0fdfa, #fff);
  border: 1px solid var(--accent-bright); border-radius: var(--r);
  padding: 14px 16px;
}
.ai-suggestion .lbl { color: var(--accent-bright); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }

/* === Setup-Onboarding-Banner === */
.setup-banner {
  background: linear-gradient(135deg, #fff7eb, #fff);
  border: 1px solid #fcd34d;
  border-left: 4px solid var(--warn);
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.setup-banner.complete {
  background: linear-gradient(135deg, #ecfdf5, #fff);
  border-color: var(--ok); border-left-color: var(--ok);
}
.setup-banner .ico {
  flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--warn); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.setup-banner.complete .ico { background: var(--ok); }
.setup-banner .content { flex: 1; }
.setup-banner h3 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.setup-banner .items { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.setup-banner .item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.setup-banner .item a {
  font-weight: 600; white-space: nowrap;
}
.setup-banner .item .detail { color: var(--muted); flex: 1; }
.setup-banner .dismiss {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; padding: 0 4px;
}
.setup-banner .dismiss:hover { color: var(--text); }

/* === FAB (Floating Action Button) === */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  box-shadow: 0 4px 12px rgba(28,46,94,.30);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.fab:hover { background: var(--accent-hover); transform: scale(1.05); box-shadow: 0 6px 18px rgba(28,46,94,.40); }

/* === Moderne KPI-Card (klickbar, klare Hierarchie) === */
.kpi-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none; color: var(--text);
  position: relative; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  min-height: 124px;
}
.kpi-card:hover {
  text-decoration: none;
  border-color: var(--border-2);
  box-shadow: 0 4px 18px rgba(15,23,42,.06);
}
.kpi-card:active { transform: translateY(1px); }
.kpi-card .ico-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
  flex: 0 0 36px;
}
.kpi-card .ico-wrap svg { width: 18px; height: 18px; }
.kpi-card .label {
  font-size: 12px; font-weight: 500;
  color: var(--muted);
  text-transform: none; letter-spacing: 0;
  line-height: 1.3;
}
.kpi-card .value {
  font-size: 34px; font-weight: 700; line-height: 1;
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi-card .sub {
  font-size: 12px; color: var(--muted);
  margin-top: auto; padding-top: 4px;
}

/* Status-Varianten — dezent, nur akzentiert wenn Wert > 0 */
.kpi-card.is-active {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.04);
}
.kpi-card.tone-err.is-active { background: #fef2f2; }
.kpi-card.tone-err.is-active .ico-wrap { background: var(--err); color: #fff; }
.kpi-card.tone-err.is-active .value { color: var(--err); }
.kpi-card.tone-warn.is-active { background: #fffbeb; }
.kpi-card.tone-warn.is-active .ico-wrap { background: var(--warn); color: #fff; }
.kpi-card.tone-warn.is-active .value { color: var(--warn); }
.kpi-card.tone-info.is-active { background: #eff6ff; }
.kpi-card.tone-info.is-active .ico-wrap { background: var(--info); color: #fff; }
.kpi-card.tone-info.is-active .value { color: var(--info); }
.kpi-card.tone-ok.is-active .ico-wrap { background: var(--ok-soft); color: var(--ok); }
.kpi-card.tone-ok.is-active .value { color: var(--ok); }

/* Section-Header: ruhig, mit dünnem Sub-Text */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 24px 0 12px;
}
.section-head:first-child { margin-top: 0; }
.section-head h2 {
  margin: 0; font-size: 15px; font-weight: 600;
  letter-spacing: -.01em; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.section-head h2 .info-icon { margin-left: 2px; }
.section-head .sub {
  font-size: 12.5px; color: var(--muted); font-weight: 400;
}
.section-head .actions { display: flex; gap: 6px; align-items: center; }

/* Datenliste — wirkt strukturierter als case-row */
.data-list { display: flex; flex-direction: column; }
.data-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.data-list-item:last-child { border-bottom: none; }
.data-list-item:hover { background: var(--surface-2); margin: 0 -12px; padding: 12px; border-radius: 8px; }
.data-list-item .primary {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.data-list-item .primary .title {
  font-weight: 600; font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-list-item .primary .meta {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-list-item .secondary { flex: 0 0 auto; }

/* Big-Stat: große Zahl + Label */
.big-stat { display: flex; align-items: baseline; gap: 8px; }
.big-stat .val { font-size: 36px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.big-stat .lbl { font-size: 13px; color: var(--muted); }

/* Funnel-Bar (moderne, klare Stufen statt naiver Balken) */
.funnel-step {
  display: grid; grid-template-columns: 130px 1fr 40px;
  align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.funnel-step:last-child { border-bottom: none; }
.funnel-step .step-label { font-size: 13px; font-weight: 500; color: var(--text); }
.funnel-step .step-bar {
  height: 10px; border-radius: 5px;
  background: var(--surface-2); overflow: hidden; position: relative;
}
.funnel-step .step-bar-fill {
  height: 100%; border-radius: 5px;
  transition: width .35s ease;
}
.funnel-step .step-val {
  font-weight: 700; font-variant-numeric: tabular-nums;
  text-align: right; color: var(--text);
}

/* Status-Pill, kompakt + monochrom */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: 0 0 6px; opacity: .8;
}
.status-pill.err { background: #fef2f2; color: var(--err); border-color: #fecaca; }
.status-pill.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.status-pill.ok { background: var(--ok-soft); color: var(--ok); border-color: #bbf7d0; }
.status-pill.info { background: #eff6ff; color: var(--info); border-color: #bfdbfe; }

/* === KI-Chat-Bubble (Strg+J global) === */
.ai-chat-toggle {
  position: fixed; bottom: 24px; right: 88px; z-index: 70;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-bright); color: #fff; border: none;
  box-shadow: 0 4px 12px rgba(43,166,161,.35);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.ai-chat-toggle:hover { background: var(--accent-bright-hover); transform: scale(1.06); }

.ai-chat-drawer {
  position: fixed; bottom: 84px; right: 24px; z-index: 70;
  width: 420px; max-height: 70vh; min-height: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: fadeIn .15s ease;
}
.ai-chat-drawer[hidden] { display: none; }
.ai-chat-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.ai-chat-head strong { font-size: 14px; }
.ai-chat-body {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-chat-empty {
  text-align: center; color: var(--muted);
  margin: auto; padding: 20px; font-size: 13px;
}
.ai-msg {
  padding: 10px 13px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.45; max-width: 90%;
  word-wrap: break-word;
}
.ai-msg-user {
  background: var(--accent); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.ai-msg-assistant {
  background: var(--surface-2); color: var(--text);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.ai-typing { color: var(--muted); font-style: italic; }
.ai-chat-input {
  border-top: 1px solid var(--border); padding: 10px;
  display: flex; gap: 8px; align-items: flex-end;
}
.ai-chat-input textarea {
  flex: 1; resize: none; font-size: 13.5px;
  min-height: 36px; max-height: 120px;
}
.ai-conv-list { max-height: 60vh; overflow-y: auto; }
.ai-conv-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ai-conv-item:hover { background: var(--surface-2); }
.ai-conv-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.ai-conv-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* === Erklär-Box (collapsable Pipeline-Erklärung) === */
.explain-box {
  background: linear-gradient(135deg, #f0f9ff, #fff);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--info);
  border-radius: 10px;
  padding: 12px 16px;
}
.explain-box summary {
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; padding: 4px 0;
  outline: none;
  list-style: none;
}
.explain-box summary::before {
  content: '▸';
  display: inline-block;
  transition: transform .15s;
  color: var(--info);
}
.explain-box[open] summary::before { transform: rotate(90deg); }
.explain-box summary::-webkit-details-marker { display: none; }
.explain-body {
  padding-top: 12px; margin-top: 10px;
  border-top: 1px solid #bfdbfe;
  font-size: 13.5px; line-height: 1.55;
}
.explain-body p { margin: 8px 0; }
.pipeline-steps {
  margin: 8px 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.pipeline-steps li {
  padding: 6px 10px;
  background: rgba(255,255,255,.6);
  border-left: 3px solid var(--info);
  border-radius: 4px;
}
.conf-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
  margin: 0 4px;
  vertical-align: middle;
}

/* === Excel-Kompakt Stammdaten-Tabelle (ultra-dense) === */
.sd-table-wrap {
  overflow: auto !important;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  max-height: calc(100vh - 280px);
  min-height: 500px;
  position: relative;
}
.sd-table-wrap::-webkit-scrollbar { height: 10px; width: 10px; }
.sd-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
.sd-table-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

table.sd-excel {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif !important;
  white-space: nowrap !important;
  width: max-content !important;
  margin: 0 !important;
}
table.sd-excel thead th.sd-th {
  background: #e8eef5 !important;
  position: sticky !important; top: 0 !important; z-index: 10 !important;
  padding: 4px 6px !important;
  font-size: 10px !important; font-weight: 700 !important;
  color: #334155 !important;
  text-transform: uppercase !important;
  letter-spacing: .02em !important;
  border-bottom: 1px solid #94a3b8 !important;
  border-right: 1px solid #d1d8e3 !important;
  text-align: left !important;
  user-select: none !important;
  height: 24px !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
}
table.sd-excel thead th.sd-th:hover { background: #dde6f0 !important; cursor: pointer; }
table.sd-excel tbody td.sd-td {
  padding: 1px 6px !important;
  border-bottom: 1px solid #eef1f5 !important;
  border-right: 1px solid #eef1f5 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
  height: 22px !important;
  line-height: 1.2 !important;
  font-size: 11px !important;
  color: #1e293b !important;
  cursor: pointer !important;
}
table.sd-excel tbody tr:hover td.sd-td { background: #fff7d6 !important; }
table.sd-excel tbody tr:nth-child(even) td.sd-td { background: #f8fafc; }
table.sd-excel tbody tr:nth-child(even):hover td.sd-td { background: #fff7d6 !important; }

/* Sticky-Spalte (Firma) */
table.sd-excel td.sd-sticky-col, table.sd-excel th.sd-sticky-col {
  position: sticky !important;
  left: 26px !important; z-index: 5 !important;
  background: var(--surface) !important;
  border-right: 2px solid #94a3b8 !important;
  font-weight: 600 !important;
}
table.sd-excel thead th.sd-sticky-col { z-index: 15 !important; background: #e8eef5 !important; }
table.sd-excel tbody tr:hover td.sd-sticky-col { background: #fff7d6 !important; }
table.sd-excel tbody tr:nth-child(even) td.sd-sticky-col { background: #f8fafc !important; }
table.sd-excel tbody tr:nth-child(even):hover td.sd-sticky-col { background: #fff7d6 !important; }

/* Checkbox-Spalte */
table.sd-excel td.sd-checkcol, table.sd-excel th.sd-checkcol {
  width: 26px !important; max-width: 26px !important; min-width: 26px !important;
  padding: 0 !important;
  text-align: center !important;
  background: #f1f5f9 !important;
  position: sticky !important;
  left: 0 !important; z-index: 6 !important;
}
table.sd-excel thead th.sd-checkcol { z-index: 16 !important; background: #e8eef5 !important; }
table.sd-excel tbody tr:nth-child(even) td.sd-checkcol { background: #ebf0f6 !important; }
table.sd-excel input[type="checkbox"] {
  width: 13px; height: 13px;
  cursor: pointer; margin: 0;
}

table.sd-excel a {
  color: var(--accent); text-decoration: none;
  font-size: 11px;
}
table.sd-excel a:hover { text-decoration: underline; }
table.sd-excel .mono { font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace !important; font-size: 10.5px !important; }
table.sd-excel .status-pill { font-size: 9px !important; padding: 0 5px !important; line-height: 1.4 !important; }

/* === Enrichment-Banner (Stammdaten-Worker Live-Status) === */
.enrich-banner {
  background: linear-gradient(135deg, #eff6ff, #fff);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--info);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.enrich-banner.paused {
  background: linear-gradient(135deg, #fffbeb, #fff);
  border-color: #fde68a;
  border-left-color: var(--warn);
}
.enrich-banner .er-head {
  display: flex; align-items: center; gap: 14px;
  font-size: 13.5px;
}
.enrich-banner .er-head strong { font-weight: 600; }
.enrich-banner .er-bar {
  height: 6px; background: rgba(28,46,94,.08); border-radius: 3px;
  margin: 8px 0 4px; overflow: hidden;
}
.enrich-banner .er-bar-fill {
  height: 100%; background: var(--info); border-radius: 3px;
  transition: width .4s ease;
}
.enrich-banner.paused .er-bar-fill { background: var(--warn); }
.enrich-banner .er-last { margin-top: 2px; }

/* Karten-Hierarchie überarbeitet */
.card { box-shadow: none; }
.card { border-radius: 12px; padding: 20px 22px; }
.card h2 {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
}
.card h2 .actions {
  margin-left: auto; display: flex; gap: 6px; font-weight: 400;
}

/* === Case-Row (kompakte Liste-Zeile im Dashboard) === */
.case-row {
  padding: 10px 0; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .12s;
}
.case-row:hover { background: var(--surface-2); margin: 0 -8px; padding: 10px 8px; }
.case-row:last-child { border-bottom: 0; }

/* === User-Pill (Initialen-Marker) === */
.user-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; flex: 0 0 auto;
}

/* === Pipeline (Funnel-Liste im AGV-Dashboard) === */
.funnel { margin-top: 10px; }

/* === Info-Icon (global, überall einsetzbar via data-info) === */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border-2);
  font-size: 11px; font-weight: 700; font-family: serif;
  cursor: help; margin-left: 6px; vertical-align: middle;
  position: relative; transition: all .12s;
  user-select: none;
}
.info-icon::before { content: 'i'; }
.info-icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.info-icon .tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark); color: #fff;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 400; line-height: 1.45;
  white-space: normal; width: max-content; max-width: 320px;
  box-shadow: var(--shadow-lg);
  z-index: 200; pointer-events: none;
  opacity: 0; transition: opacity .12s;
  font-family: inherit; text-align: left;
}
.info-icon:hover .tooltip,
.info-icon.show .tooltip {
  opacity: 1;
}
.info-icon .tooltip::after {
  content: ''; position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg-dark);
}

/* === Pill Eskalations-Varianten === */
.pill.err { background: var(--err-soft); color: var(--err); border-color: transparent; }

main { padding: 18px 24px 60px; max-width: 1600px; margin: 0 auto; }

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .body { margin-top: 6px; }
.card.compact { padding: 12px 14px; }

/* === Grid === */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

/* === KPI Tiles === */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 700; color: var(--text); margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { border-left: 4px solid var(--accent); }
.kpi.ok { border-left: 4px solid var(--ok); }
.kpi.warn { border-left: 4px solid var(--warn); }
.kpi.err { border-left: 4px solid var(--err); }
.kpi.info { border-left: 4px solid var(--info); }
.kpi.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.kpi.clickable:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.07); border-color: var(--accent); }
.kpi.clickable:active { transform: translateY(0); }
.clickable-row:hover { background: var(--surface-2); border-radius: 4px; padding-left: 4px; transition: background .1s ease; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.success { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.success:hover { background: #355a2a; border-color: #355a2a; }
.btn.danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.block { width: 100%; justify-content: center; }
.btn .ico { display: inline-flex; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* === Forms === */
label.field { display: block; margin-bottom: 10px; }
label.field > .lbl,
.field-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--muted); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: .03em;
}
input[type=text], input[type=email], input[type=tel], input[type=url],
input[type=number], input[type=date], input[type=password], input[type=search],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text); font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,46,94,.13);
}
textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.required { color: var(--err); }

/* === Badges + Pills === */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .03em;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.lg { padding: 4px 12px; font-size: 12px; }

/* === Tables === */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
table.data thead th {
  background: var(--surface-2);
  text-align: left; padding: 9px 12px;
  font-size: 11.5px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
table.data tbody td {
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
table.data tbody tr:hover { background: var(--surface-2); cursor: pointer; }
table.data tbody tr.dim { opacity: .55; }
table.data .right { text-align: right; }
table.data .compact { padding: 5px 10px; font-size: 12.5px; }
.table-wrap { overflow-x: auto; border-radius: var(--r); }

/* === Toasts === */
.toast-wrap {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
  animation: slideIn .25s ease;
  cursor: pointer;
}
.toast .body { flex: 1; }
.toast .ttl { font-weight: 600; margin-bottom: 2px; }
.toast.ok { border-left: 4px solid var(--ok); }
.toast.err { border-left: 4px solid var(--err); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warn { border-left: 4px solid var(--warn); }
.toast .x {
  cursor: pointer; opacity: .55; font-size: 18px; line-height: 1; padding: 0 4px;
  align-self: flex-start; user-select: none;
}
.toast .x:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
/* Sticky-Toast für runWithFeedback: subtiler Animations-Indikator */
.toast.sticky {
  border-left-style: solid; border-left-width: 4px;
  background: linear-gradient(90deg, rgba(28,46,94,.04) 0%, transparent 30%);
  position: relative;
}
.toast.sticky::before {
  content: ''; position: absolute; left: 0; top: 0; height: 100%;
  width: 3px; background: var(--info);
  animation: stickyPulse 1.2s ease-in-out infinite;
}
@keyframes stickyPulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* === Button-Feedback (btnAction Helper) === */
.btn .btn-spin {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .6s linear infinite; vertical-align: -2px;
}
.btn .btn-check, .btn .btn-fail {
  display: inline-block; margin-right: 6px; font-weight: 700;
}
.btn.is-busy { opacity: .85; cursor: progress !important; }
.btn.is-ok {
  background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important;
  animation: btnPulseOk .35s ease;
}
.btn.is-fail {
  background: var(--err) !important; border-color: var(--err) !important; color: #fff !important;
  animation: btnShake .35s ease;
}
@keyframes btnPulseOk { 0% { transform: scale(.96); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes btnShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* === Modals === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 900px; }
.modal .head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal .head h2 { margin: 0; }
.modal .body { padding: 18px 20px; }
.modal .foot {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: var(--surface);
}
.close-x {
  cursor: pointer; padding: 6px; border-radius: 6px;
  color: var(--muted);
}
.close-x:hover { background: var(--surface-2); color: var(--text); }

/* === Confirm/Alert/Prompt Dialog-Bodies === */
.confirm-body {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 4px 0 8px;
}
.confirm-body .confirm-icon {
  flex: 0 0 auto; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
}
.confirm-body.confirm-icon-danger .confirm-icon { background: rgba(220, 38, 38, .10); }
.confirm-body.confirm-icon-warn   .confirm-icon { background: rgba(217, 119, 6, .10); }
.confirm-body.confirm-icon-info   .confirm-icon { background: rgba(37, 99, 235, .10); }
.confirm-body.confirm-icon-ok     .confirm-icon { background: rgba(22, 163, 74, .10); }
.confirm-body .confirm-text { flex: 1 1 auto; min-width: 0; }
.confirm-body .confirm-text p { margin: 0 0 6px; line-height: 1.5; color: var(--text); }
.confirm-body .confirm-text p:last-child { margin-bottom: 0; }
.confirm-body .confirm-text strong { color: var(--text); }
.confirm-body .confirm-text ul,
.confirm-body .confirm-text ol { margin: 6px 0 0 18px; padding: 0; }
.confirm-body .confirm-text code {
  background: var(--surface-2); padding: 1px 6px;
  border-radius: 4px; font-size: 12px;
}

.prompt-body input[type="text"],
.prompt-body input[type="email"],
.prompt-body input[type="number"],
.prompt-body input[type="url"],
.prompt-body input[type="password"],
.prompt-body textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font-size: 14px; box-sizing: border-box;
}
.prompt-body input:focus,
.prompt-body textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* === Stammdaten Per-Row-Actions === */
.sd-row-actions {
  text-align: right; padding-right: 6px;
}
.sd-row-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 5px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; padding: 0;
  transition: all .12s ease;
  text-decoration: none;
}
.sd-row-btn:hover {
  background: var(--accent-soft, rgba(37, 99, 235, .08));
  border-color: var(--accent);
  color: var(--accent);
}
.sd-row-btn:active { transform: scale(.95); }

/* === Enrich-Scope-Cards (Auswahl-Modal) === */
.enrich-scope-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  background: var(--surface); transition: all .15s ease;
}
.enrich-scope-card:hover { border-color: var(--accent); background: var(--surface-2); }
.enrich-scope-card input[type="radio"] { margin-top: 2px; flex: 0 0 auto; }
.enrich-scope-card input[type="radio"]:checked + div { color: var(--accent); }
.enrich-scope-card:has(input:checked) {
  border-color: var(--accent); background: rgba(37, 99, 235, .04);
  box-shadow: 0 0 0 1px var(--accent);
}
.enrich-scope-card > div { flex: 1 1 auto; min-width: 0; }
.enrich-scope-card strong { display: block; margin-bottom: 2px; }

/* === Live-Status-Widget (rechts unten) === */
/* Log-Status: dezenter, aufklappbarer Button rechts unten (ueber dem Bug-Button),
   im Stil der FABs. Eingeklappt = kleine Pille; Klick oeffnet das Panel nach oben. */
.live-status {
  position: fixed; left: 16px; right: auto; bottom: 14px; z-index: 60;
  display: flex; flex-direction: column-reverse;   /* Kopf unten, Body oeffnet nach oben */
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow);
  min-width: 0; max-width: 340px; font-size: 12.5px;
}
.live-status:not(.collapsed) { border-radius: var(--r); min-width: 250px; }
.live-status .head {
  padding: 7px 13px; cursor: pointer; border-bottom: none;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.live-status:not(.collapsed) .head { border-top: 1px solid var(--border); }
.live-status .head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.live-status.active .head .dot { background: var(--ok); animation: pulse 1.4s infinite; }
.live-status.warn .head .dot { background: var(--warn); }
.live-status.err .head .dot { background: var(--err); }
.live-status .ls-label { font-weight: 600; color: var(--muted); font-size: 12px; }
.live-status:not(.collapsed) .ls-label { display: none; }
.live-status.collapsed #lsHead, .live-status.collapsed #lsBadge { display: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.live-status .body { padding: 8px 13px; max-height: 220px; overflow-y: auto; min-width: 240px; }
.live-status .body .row { padding: 4px 0; font-size: 12px; gap: 6px; }
.live-status .body .row .muted { color: var(--muted); font-size: 11px; }
.live-status.collapsed .body { display: none; }

/* === Notifications Drawer === */
.notif-panel {
  position: fixed; top: 56px; right: 12px; z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  width: 380px; max-height: 70vh; overflow-y: auto;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel .head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface);
}
.notif-panel .item {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-panel .item:hover { background: var(--surface-2); }
.notif-panel .item.unread { background: var(--accent-soft); }
.notif-panel .item .ttl { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-panel .item .msg { font-size: 12.5px; color: var(--muted); }
.notif-panel .item .meta { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.notif-panel .empty { padding: 30px 16px; text-align: center; color: var(--muted); }

/* === Login-Page === */
body.login {
  background: linear-gradient(180deg, #0f172a 0%, #1e3a4a 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  padding: 32px 28px;
  border-radius: var(--r-lg);
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.login-card .brand-block {
  text-align: center; margin-bottom: 20px;
}
.login-card .brand-block img { max-width: 220px; height: auto; }
.login-card .brand-block .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.login-card h1 { text-align: center; margin: 16px 0 6px; font-size: 18px; }
.login-card .subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .err-box {
  background: var(--err-soft); color: var(--err);
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 14px;
}

/* === Detail-Tabs === */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  padding: 9px 14px; background: transparent; border: 0;
  font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 13.5px;
  font-family: inherit;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Vertragspaket-Übersicht === */
.doc-checklist { list-style: none; padding: 0; margin: 0; }
.doc-checklist li {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
}
.doc-checklist li .name { flex: 1; }
.doc-checklist li.signed { background: var(--ok-soft); border-color: transparent; }
.doc-checklist li.pending { background: var(--warn-soft); border-color: transparent; }

/* === Suggested-Action (KI-Vorschlag) === */
.ai-suggestion {
  background: linear-gradient(135deg, #f0f7fa 0%, #e3eef2 100%);
  border: 1px solid var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 12px;
}
.ai-suggestion .lbl { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.ai-suggestion .txt { margin-top: 4px; font-size: 13.5px; color: var(--text); }
.ai-suggestion .actions { margin-top: 8px; display: flex; gap: 6px; }

/* === Empty-State === */
.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--r);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* === Loader === */
.loader {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.loader.lg { width: 26px; height: 26px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Sidebar/Right-Drawer === */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100%;
  background: var(--surface); box-shadow: -8px 0 32px rgba(15,23,42,.18);
  z-index: 900; overflow-y: auto;
  transform: translateX(100%); transition: transform .25s ease;
}
.drawer.open { transform: translateX(0); }
.drawer .head {
  position: sticky; top: 0; background: var(--surface);
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  z-index: 1;
}
.drawer .body { padding: 16px 18px; }

/* === Search Dropdown (jetzt unter neuer search-bar) === */
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg);
  max-height: 70vh; overflow-y: auto; overflow-x: hidden; z-index: 60;
  display: none;
}
.search-results.open { display: block; }
.search-results .group-lbl {
  padding: 8px 14px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.search-results .item {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 13.5px;
  /* Wichtig: Wörter dürfen nicht zeichenweise umbrechen */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  word-break: normal; overflow-wrap: normal;
}
.search-results .item:hover, .search-results .item.active { background: var(--accent-soft); }
.search-results .item .meta {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-results .item .title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}

/* === Quick-Actions FAB === */
.fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 700;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 0;
  box-shadow: 0 8px 24px rgba(28,46,94,.35);
  transition: transform .15s, box-shadow .15s;
  font-family: inherit;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(28,46,94,.45); }

/* === Status-Pill speziell für Verträge === */
.status-pill { font-size: 11.5px; padding: 3px 10px; font-weight: 600; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.status-draft { background: #f1f5f9; color: #475569; }
.status-sent { background: #dbeafe; color: #1e40af; }
.status-partial { background: #fef3c7; color: #92400e; }
.status-signed { background: #dcfce7; color: #166534; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-declined { background: #fee2e2; color: #991b1b; }
.status-expired { background: #fed7aa; color: #9a3412; }
.status-voided { background: #e5e7eb; color: #374151; }
.status-terminated { background: #fce7f3; color: #9d174d; }

/* === Inkasso/Type Badges === */
.tag-at { background: #fef9c3; color: #854d0e; font-weight: 600; }
.tag-de { background: #cffafe; color: #155e75; font-weight: 600; }
.tag-kette { background: #ede9fe; color: #5b21b6; font-weight: 600; }
.tag-zentrale { background: #fce7f3; color: #9d174d; font-weight: 600; }
.tag-einzel { background: #f3f4f6; color: #374151; font-weight: 600; }

/* === Util === */
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.center { text-align: center; }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.full-width { width: 100%; }

/* === schmales Fenster (nicht Mobile, nur kleine Bildschirme) === */
@media (max-width: 1500px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
/* Generell: grid-Items dürfen nicht aus dem Container raus */
.grid > * { min-width: 0; }

/* ============================================================
   UX-Welle (2026-05-24)
   ============================================================ */

/* --- Filter-Chips (Stammdaten + global) --- */
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; margin: 0 0 8px;
  padding: 6px 8px;
  background: var(--accent-soft);
  border-radius: 6px;
  border: 1px solid #d6dded;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px;
  background: #fff;
  border: 1px solid #c3cee0;
  border-radius: 999px;
  font-size: 11.5px; color: var(--accent);
  cursor: pointer; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.filter-chip:hover { background: #fef2f2; border-color: var(--err); color: var(--err); }
.filter-chip svg { opacity: .55; }
.filter-chip:hover svg { opacity: 1; }
.filter-chip-reset {
  margin-left: auto;
  padding: 3px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11.5px; font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.filter-chip-reset:hover { color: var(--err); border-color: var(--err); }

/* --- Stammdaten-Tabelle: Konfidenz-Border statt Hintergrund --- */
table.sd-excel tbody td.sd-conf-low {
  border-left: 3px solid var(--err) !important;
  background: #fef2f2 !important;
}
table.sd-excel tbody td.sd-conf-medium {
  border-left: 3px solid var(--warn) !important;
  background: #fff7ed !important;
}
table.sd-excel tbody td.sd-conf-good {
  border-left: 3px solid #ca8a04 !important;
  background: #fefce8 !important;
}
/* Hover-Farbe darf Konfidenz-Border nicht überlagern */
table.sd-excel tbody tr:hover td.sd-conf-low { background: #fde9e9 !important; }
table.sd-excel tbody tr:hover td.sd-conf-medium { background: #fef0e0 !important; }
table.sd-excel tbody tr:hover td.sd-conf-good { background: #fdf6ce !important; }

/* --- Scroll-Edge-Shadows + Hint-Pulse für 37-Spalten-Tabelle --- */
.sd-table-wrap { transition: box-shadow .25s; }
.sd-table-wrap.has-scroll-right { box-shadow: inset -18px 0 16px -10px rgba(15,23,42,.10); }
.sd-table-wrap.has-scroll-left  { box-shadow: inset 18px 0 16px -10px rgba(15,23,42,.10); }
.sd-table-wrap.has-scroll-right.has-scroll-left {
  box-shadow: inset -18px 0 16px -10px rgba(15,23,42,.10),
              inset  18px 0 16px -10px rgba(15,23,42,.10);
}
@keyframes scrollHintPulse {
  0%, 100% { box-shadow: inset -18px 0 16px -10px rgba(43,166,161,.55); }
  50%      { box-shadow: inset -36px 0 22px -10px rgba(43,166,161,.85); }
}
.sd-table-wrap.scroll-hint-pulse {
  animation: scrollHintPulse 1.1s ease-in-out infinite;
}

/* --- Empty-State (global) --- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  gap: 10px;
  min-height: 240px;
}
.empty-state svg { margin-bottom: 6px; }
.empty-state h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.empty-state p { margin: 0; color: var(--muted); max-width: 460px; font-size: 13.5px; line-height: 1.55; }
.empty-state .btn { margin-top: 8px; }
.empty-state.compact { padding: 28px 18px; min-height: 0; }

/* --- Tab-Draft-Dot (Reklamation/Werkstatt) --- */
.tab-btn .tab-dirty-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-bright);
  margin-left: 6px; vertical-align: 1px;
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,100% { transform: scale(1);   opacity: .85; }
  50%     { transform: scale(1.25); opacity: 1; }
}
.tab-save-state {
  margin-left: auto; padding: 0 10px;
  font-size: 11.5px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
}
.tab-save-state.ok  { color: var(--ok); }
.tab-save-state.err { color: var(--err); }
.tab-save-state.busy { color: var(--accent); }
.tab-save-state.busy::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); animation: pulseDot 1.4s infinite;
}

/* --- Shortcut-Help-Panel (?-Taste) --- */
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; }
.shortcut-group h4 {
  margin: 0 0 6px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.shortcut-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0; font-size: 13px;
}
.shortcut-row .desc { color: var(--text); }
.kbd {
  display: inline-flex; align-items: center;
  background: #f1f5f9;
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  padding: 1px 7px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px; font-weight: 600;
  color: var(--text); margin-left: 3px;
}
.kbd-sep { margin: 0 4px; color: var(--muted-2); font-size: 11px; }

/* --- Onboarding-Coachmarks --- */
.coach-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(2px);
}
.coach-spotlight {
  position: fixed; z-index: 9999;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(43,166,161,.85), 0 0 0 9999px rgba(15,23,42,.55);
  pointer-events: none;
  transition: all .35s cubic-bezier(.4,0,.2,1);
}
.coach-card {
  position: fixed; z-index: 10000;
  background: #fff; border-radius: 10px;
  box-shadow: 0 18px 48px rgba(15,23,42,.30);
  padding: 18px 20px; max-width: 340px;
  font-size: 13.5px; line-height: 1.55;
}
.coach-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.coach-card p { margin: 0 0 12px; color: var(--muted); }
.coach-card .coach-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px;
}
.coach-progress { color: var(--muted); font-size: 11.5px; }

/* --- Command-Palette --- */
.cmdpal-overlay {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(15,23,42,.45);
  display: flex; justify-content: center;
  padding-top: 10vh;
}
.cmdpal {
  width: 640px; max-width: 92vw; max-height: 70vh;
  background: #fff; border-radius: 12px;
  box-shadow: 0 24px 70px rgba(15,23,42,.32);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.cmdpal-input {
  width: 100%; box-sizing: border-box;
  padding: 16px 18px; font-size: 15px;
  border: 0; outline: 0;
  border-bottom: 1px solid var(--border);
}
.cmdpal-body { overflow-y: auto; padding: 4px 0; }
.cmdpal-group-lbl {
  padding: 8px 16px 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.cmdpal-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13.5px;
}
.cmdpal-item.active { background: var(--accent-soft); border-left-color: var(--accent); }
.cmdpal-item:hover  { background: #f8fafc; }
.cmdpal-item .meta { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.cmdpal-item svg { color: var(--muted); flex-shrink: 0; }
.cmdpal-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.cmdpal-foot {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex; gap: 14px;
  font-size: 11px; color: var(--muted);
}

/* --- Inline-Validation (Edit-Modal) --- */
.field-valid    { border-color: var(--ok) !important; }
.field-invalid  { border-color: var(--err) !important; }
.field-pending  { border-color: var(--warn) !important; }
.field-helper {
  font-size: 11.5px; margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
.field-helper.ok  { color: var(--ok); }
.field-helper.err { color: var(--err); }
.field-helper.busy { color: var(--muted); }

/* === Toast erweitert: kritische Fehler länger sichtbar === */
.toast.err {
  border-left: 4px solid var(--err);
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 22px rgba(220,38,38,.18);
}
.toast.err .body { color: #991b1b; }

/* === Responsive Breakpoints (UX-9) === */
@media (max-width: 900px) {
  /* Topbar kompakt */
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar .nav { flex-wrap: wrap; gap: 4px; }
  .topbar .nav a span:not(.badge):not(.count) { display: none; }
  .topbar .nav a { padding: 8px; }
  .topbar .search { order: 99; flex-basis: 100%; max-width: 100%; }
  .topbar .brand img { width: 36px; height: 36px; }
  .dept-switcher .dept-name { display: none; }

  /* Hauptseiten */
  main { padding: 10px; }
  .grid { grid-template-columns: 1fr !important; }
  .row.between.wrap { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 20px !important; }

  /* Stammdaten: Karten-Layout statt Excel-Tabelle */
  .sd-table-wrap { max-height: none !important; min-height: 0 !important; }
  table.sd-excel { font-size: 12px !important; }
  table.sd-excel thead { display: none; }
  table.sd-excel, table.sd-excel tbody, table.sd-excel tr, table.sd-excel td {
    display: block !important; width: 100% !important; max-width: 100% !important; min-width: 0 !important;
  }
  table.sd-excel tr {
    margin-bottom: 8px; padding: 8px;
    background: var(--surface) !important;
    border: 1px solid var(--border); border-radius: 6px;
  }
  table.sd-excel td.sd-td {
    border: 0 !important; height: auto !important;
    padding: 3px 0 !important;
    white-space: normal !important;
  }
  table.sd-excel td.sd-sticky-col, table.sd-excel td.sd-checkcol {
    position: static !important;
  }
  table.sd-excel td.sd-sticky-col {
    font-size: 15px !important; font-weight: 700 !important;
    padding: 2px 0 6px !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 4px;
  }

  /* Modal Vollbild */
  .modal { width: 95vw !important; max-height: 90vh !important; }
  .modal.wide { width: 98vw !important; }

  /* Cards atmen */
  .card { padding: 12px !important; }

  /* Filter-Chips bleiben gut sichtbar */
  .filter-chips { padding: 8px; }
}

@media (max-width: 600px) {
  .topbar .brand .sub { display: none; }
  .live-status { bottom: 4px; right: 4px; max-width: calc(100vw - 8px); }
  /* AI-Bubble nicht im Daumen-Bereich */
  .ai-chat-toggle { bottom: 70px !important; }
}

/* ============================================================
   UX-Welle 2 (2026-05-24) — App-Version 1.4.0
   ============================================================ */

/* --- Mail-Liste: ungelesene markieren --- */
.mail-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.mail-row:hover { background: #f8fafc; }
.mail-row.is-active { background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 9px; }
.mail-row-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-2);
  flex-shrink: 0; margin-top: 6px;
}
.mail-row.is-unread {
  background: rgba(28,46,94,.04);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
.mail-row.is-unread .mail-row-dot { background: var(--accent-bright); box-shadow: 0 0 0 3px rgba(43,166,161,.18); }
.mail-row.is-unread .mail-row-sender { color: var(--accent); font-weight: 700; }
.mail-row.is-unread .mail-row-subject { font-weight: 600; }
.mail-row-sender { font-size: 13.5px; }
.mail-row-subject { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mail-row-date { flex-shrink: 0; padding-left: 8px; align-self: flex-start; padding-top: 2px; }

/* --- Dashboard-KPI: Hover-Lift + Chevron --- */
.kpi-card { position: relative; transition: transform .15s, box-shadow .15s, border-color .15s; }
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
  border-color: var(--accent-bright);
}
.kpi-card .kpi-chevron { color: var(--muted-2); transition: transform .15s, color .15s; }
.kpi-card:hover .kpi-chevron { color: var(--accent); transform: translateX(3px); }

/* --- Deadline-Pill nowrap --- */
.deadline-pill {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
  font-size: 11px !important;
  padding: 1px 7px !important;
  max-width: 11ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Agentur-Detail: prominenter Vertrag-CTA --- */
.btn.lg.cta-vertrag {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: #fff !important; border: 0;
  padding: 10px 18px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(43,166,161,.25);
  letter-spacing: .01em;
}
.btn.lg.cta-vertrag:hover {
  box-shadow: 0 10px 26px rgba(43,166,161,.40);
  transform: translateY(-1px);
}

/* --- Bulk-Bar sticky --- */
.bulk-bar-sticky {
  position: sticky !important;
  top: 8px;
  z-index: 50;
  box-shadow: 0 6px 18px rgba(15,23,42,.12);
}

/* --- Reklamationen: aktive Sort-Buttons --- */
.sort-bar .sort-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff;
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-weight: 500;
}
.sort-bar .sort-btn:hover { color: var(--text); border-color: var(--accent); }
.sort-bar .sort-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* --- Packages: DocuSign-Sync-Frische-Dot --- */
.ds-status {
  display: inline-flex; align-items: center; gap: 6px;
}
.sync-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.sync-dot-fresh  { background: var(--ok);  box-shadow: 0 0 0 3px rgba(66,110,52,.18); animation: syncPulse 2.5s ease-in-out infinite; }
.sync-dot-stale  { background: var(--warn); box-shadow: 0 0 0 3px rgba(217,119,6,.16); }
.sync-dot-old    { background: var(--err);  box-shadow: 0 0 0 3px rgba(220,38,38,.14); }
.sync-dot-muted  { background: var(--muted-2); }
@keyframes syncPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(66,110,52,.10); }
  50%     { box-shadow: 0 0 0 5px rgba(66,110,52,.28); }
}
.sync-refresh-btn { padding: 2px 5px !important; line-height: 1 !important; margin-left: 2px; }
.sync-refresh-btn svg { display: block; }
.sync-refresh-btn:hover svg { transform: rotate(180deg); transition: transform .35s; }

/* --- Wissensbasis Upload-Progress --- */
.kb-dropzone, .att-dropzone {
  border: 2px dashed var(--border-2);
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.kb-dropzone:hover, .kb-dropzone.drag-over,
.att-dropzone:hover, .att-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.kb-progress { margin-top: 12px; }
.kb-progress.active {
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.kb-progress-bar {
  width: 100%; height: 6px;
  background: #e2e8f0; border-radius: 999px;
  overflow: hidden;
}
.kb-progress-bar-fill {
  height: 100%; background: var(--accent-bright);
  width: 0; transition: width .2s ease-out;
}
.kb-progress-files {
  width: 100%; margin-top: 8px; font-size: 11.5px;
  border-collapse: collapse;
}
.kb-progress-files td {
  padding: 3px 6px; border-bottom: 1px solid var(--border);
  text-align: left;
}
.kb-pf-name { word-break: break-all; }
.kb-progress-summary {
  margin-top: 8px; padding: 6px 10px;
  background: var(--surface-2); border-radius: 6px;
  font-size: 12px; color: var(--text); text-align: left;
}
.loader-sm {
  display: inline-block; width: 9px; height: 9px;
  border: 2px solid var(--accent); border-top-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite;
  margin-right: 4px; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Agentur-Save-Flash --- */
.saved-flash {
  animation: saveFlash 1.4s ease-out;
}
@keyframes saveFlash {
  0%   { box-shadow: 0 0 0 0 rgba(66,110,52,.0), 0 0 0 transparent; }
  20%  { box-shadow: 0 0 0 3px rgba(66,110,52,.50), 0 0 22px rgba(66,110,52,.20); }
  100% { box-shadow: 0 0 0 0 rgba(66,110,52,.0); }
}

/* --- Login: helper-block --- */
.login-helpers { margin-top: 14px; }
.login-helpers .btn.ghost.block {
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  background: var(--surface-2);
}

/* --- Sparklines --- */
.sparkline { display: inline-block; }

/* --- DocuSign Template-Cards --- */
.tpl-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.tpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tpl-card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.tpl-card-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.tpl-thumb {
  width: 38px; height: 46px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.tpl-card-titlewrap { min-width: 0; flex: 1; }
.tpl-card-title {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tpl-card-desc {
  flex: 1;
  font-size: 12.5px; line-height: 1.5;
  color: var(--muted);
  margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tpl-card-meta {
  display: flex; gap: 10px;
  font-size: 11px; color: var(--muted-2);
  padding-top: 8px; border-top: 1px solid var(--border);
  margin-bottom: 10px;
}
.tpl-card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.tpl-card-actions { display: flex; justify-content: flex-end; }

/* --- Karten-Onboarding-Tipp --- */
.map-tip {
  position: absolute;
  top: 12px; right: 12px;
  background: #fff;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 260px;
  box-shadow: 0 14px 30px rgba(15,23,42,.18);
  z-index: 500;
  font-size: 12.5px;
}
.map-tip-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.map-tip-x { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); padding: 0 4px; }
.map-tip-x:hover { color: var(--err); }
.map-tip-list { margin: 0; padding-left: 18px; line-height: 1.65; color: var(--text); }
.map-tip-list strong { color: var(--accent); }

/* === Print === */
@media print {
  .topbar, .live-status, .fab, .notif-panel, .btn { display: none !important; }
  body { background: #fff; }
}

/* ============================================================
   Responsive-Haertung (2026-06-03) — solide Mobil-Anzeige in ALLEN Bereichen.
   Ergaenzt die bestehenden 900px/600px-Bloecke; kommt zuletzt -> gewinnt im Cascade.
   ============================================================ */
@media (max-width: 820px) {
  /* Generische Tabellen: horizontal scrollbar statt Layout-Bruch (sd-excel ist separat als Karten geloest) */
  main table:not(.sd-excel) { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Zwei-Spalten-/Listen-Detail-Layouts stapeln */
  .split, .two-col, .twocol, .list-detail, .mail-layout, .complaint-layout, .detail-split, .col-2, .layout-2 {
    display: block !important; grid-template-columns: 1fr !important;
  }
  .pane-left, .pane-right, .list-pane, .detail-pane, .side-left, .side-right {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important; position: static !important;
  }

  /* Touch-freundlich: 16px verhindert iOS-Auto-Zoom, groessere Trefferflaechen */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 40px; }
  .btn, button { min-height: 40px; }

  /* Modale vollflaechig + scrollbar */
  .modal { width: 96vw !important; max-width: 96vw !important; max-height: 92vh !important; overflow: auto !important; }
  .modal.wide, .modal.xl, .modal.lg { width: 98vw !important; max-width: 98vw !important; }

  /* Globale Suche volle Breite */
  .topbar-search { min-width: 0 !important; flex-basis: 100%; max-width: 100%; order: 99; }

  /* Live-Status-Widget mobil ausblenden (Daumen-Bereich frei) */
  .live-status, .status-widget { display: none !important; }

  /* Aktions-Reihen/Toolbars umbrechen */
  .actions, .btn-row, .toolbar, .filter-bar { flex-wrap: wrap !important; }

  /* Medien nie ueber Breite */
  canvas, svg, img, video, iframe { max-width: 100%; height: auto; }

  /* Karten/Heatmap begrenzte Hoehe */
  #map, .leaflet-container, .map, .heatmap-map { height: 60vh !important; min-height: 0 !important; }

  /* Tabs horizontal scrollbar */
  .tabs, .tab-bar, .subnav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  main, .content { padding: 8px !important; }
  h1 { font-size: 18px !important; }
  h2 { font-size: 16px !important; }
  .card { padding: 10px !important; }
  .topbar { padding: 6px 8px; }
  /* Alle Karten-/KPI-Raster einspaltig */
  .grid, .kpi-grid, .cards, .card-grid, .stat-grid, .tiles { grid-template-columns: 1fr !important; gap: 8px !important; }
  .actions .btn, .btn-row .btn { flex: 1 1 auto; }
  /* Modale ganz voll */
  .modal { width: 100vw !important; max-width: 100vw !important; max-height: 100vh !important; border-radius: 0 !important; }
  /* Toasts volle Breite */
  .toast, .toasts { left: 8px !important; right: 8px !important; max-width: calc(100vw - 16px) !important; }
}

/* ============================================================
   UX-Politur (2026-06-04) — Accessibility + konsistente Zustaende
   ============================================================ */
/* Tastatur-Fokus sichtbar (Accessibility, jetzt Multi-User/oeffentlich) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a:focus-visible, .btn:focus-visible, button:focus-visible { outline-offset: 3px; }

/* Deaktivierte Buttons/Eingaben klar erkennbar */
.btn:disabled, button:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

/* Button im Lade-Zustand: <button class="btn loading"> */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}

/* Empty-State freundlicher (optionaler CTA + Beschreibung) */
.empty .btn { margin-top: 12px; }
.empty p { margin: 4px 0 0; font-size: 13.5px; }

/* Ruhige, konsistente Uebergaenge */
.btn, .card, .kpi-card, input, select, textarea, a { transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }

/* Markenkonforme Auswahlfarbe */
::selection { background: rgba(43,166,161,.22); }

/* Touch: groessere Tap-Flaeche fuer Icon-Elemente auf Mobil */
@media (max-width: 820px) {
  .btn.icon, .icon-btn, .bell, .close-x { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
}
