:root {
  /* ---- Markenpalette: Tiefsee-Navy + Cyan + Grau (Quelle: design-system) ---- */
  --nacht-deep: #06101a;
  --nacht: #0b1a28;
  --tiefsee: #102a3d;
  --helix: #22405a;
  --cyan-light: #bff2fc;
  --cyan-soft-flat: #d6f3fa;

  /* ---- Funktions-Tokens (Namen beibehalten, Werte an Palette angeglichen) ---- */
  --ink: #1f2e38;             /* Text dunkel (war #0f172a) */
  --primary-dark: #102a3d;    /* tiefsee — dunkle Flächen, Avatare, dunkle Buttons (war #334455) */
  --primary-dark-2: #0b1a28;  /* nacht — Hover dunkler (war #3d5563) */
  --accent-cyan: #00bbdd;     /* cyan — Primärakzent */
  --accent-cyan-hover: #0096b3; /* cyan-dark (war #0099bb) */
  --accent-cyan-soft: rgba(0,187,221,0.08);
  --accent-cyan-mid:  rgba(0,187,221,0.18);
  --bg: #f6f8fa;             /* paper (war #f6f7f8) */
  --bg-2: #eaeff2;           /* paper-2 (war #eceef1) */
  --surface: #ffffff;
  --border: #dbe3e8;         /* line (war #e2e4e7) */
  --border-strong: #c2ccd4;  /* (war #c7cbd1) */
  --muted: #5d6e79;          /* ink-soft — Fließtext sekundär (war #6b7380) */
  --muted-2: #8a96a0;        /* (war #9aa0a9) */
  --muted-3: #b3bcc4;        /* (war #b8bcc4) */
  --sidebar-w: 60px;
  --topbar-h: 56px;
  --crumbs-h: 32px;
  --chrome-h: calc(var(--topbar-h) + var(--crumbs-h));
  --assistant-h: 0px;   /* früher reservierter Platz für eine KI-Assistant-Bar; entfällt */

  /* ---- Schriften ---- */
  --font-display: "Titillium Web", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Titillium Web", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ============================================================ TYPO-ROLLEN (Markenpalette)
   Display = Titillium Web (Headlines/Zahlen, eng, -0.02em)
   Mono    = JetBrains Mono (Labels, Eyebrows, IDs, Kennzahlen) */
.topbar-brand-text,
.column-title, .focus-title, .modal-title,
.detail-title, .search-detail-title,
.verdict-word, .briefing-stat-value,
.dash-card .value, .plan-card .price, .plan-option .price,
.onboarding-panel h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.topbar-brand-sub,
.card-pid, .tender-row-meta .pid, .detail-meta-line .pid,
.history-date, .kbd {
  font-family: var(--font-mono);
}

/* ============================================================ ICON DEFAULTS */
svg { width: 14px; height: 14px; flex-shrink: 0; }
img { max-width: 100%; }
.sidebar-btn svg { width: 20px; height: 20px; }
.searchbar svg { width: 18px; height: 18px; }
.assistant-send svg { width: 16px; height: 16px; }
.card-fav svg, .fav-btn svg,
.card-deadline svg, .tender-row-meta svg, .card-meta svg,
.tool-btn svg, .detail-source svg,
.fav-toggle svg,
.agent-item-stats svg { width: 12px; height: 12px; }
.topbar-company-caret { width: 12px; height: 12px; }
.zoom-switch-btn svg { width: 14px; height: 14px; }
.icon-btn svg { width: 16px; height: 16px; }
.doc-size svg { width: 12px; height: 12px; vertical-align: middle; }
a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================ TOP BAR */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  z-index: 60;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 220px; text-decoration: none; cursor: pointer; }
.topbar-brand:hover .topbar-brand-text { color: var(--accent-cyan); }
.topbar-brand-logo {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-brand-logo img { width: 32px; height: 32px; object-fit: contain; }
.topbar-brand-text { font-family: "Titillium Web", var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); letter-spacing: 0.2px; }
.topbar-brand-sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }

/* Globale Suchleiste IN der Topbar (zwischen Logo und Profil), füllt den
   gesamten verfügbaren Mittelteil. */
.topbar-search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 16px;
  margin: 0 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.topbar-search:focus-within {
  border-color: var(--accent-cyan);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,187,221,0.10);
}
.topbar-search-icon { width: 16px; height: 16px; color: var(--muted-2); flex-shrink: 0; }
.topbar-search:focus-within .topbar-search-icon { color: var(--accent-cyan); }
.topbar-search-input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-size: 14px; color: var(--ink);
  font-family: inherit;
}
.topbar-search-input::placeholder { color: var(--muted-2); }
.topbar-search-input::-webkit-search-cancel-button { display: none; }

/* Breadcrumb-Zeile direkt unter der Topbar — aber nur ueber dem Content,
   nicht ueber der Sidebar (=> kein Versatz Logo/Sidebar). */
.crumbs-row {
  position: fixed; top: var(--topbar-h); left: var(--sidebar-w); right: 0; height: var(--crumbs-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  font-size: 12.5px; color: var(--muted);
  z-index: 59;
}
.crumbs-row .crumb-jump { cursor: pointer; color: var(--ink); text-decoration: none; }
.crumbs-row .crumb-jump:hover { color: var(--accent-cyan); }
.crumbs-row .crumb-prefix { color: var(--muted-3); font-family: var(--font-mono); margin-right: 8px; user-select: none; }
.crumbs-row .crumb-sep { color: var(--muted-3); margin: 0 8px; }
.crumbs-row .crumb-current { color: var(--ink); font-weight: 600; }
.crumbs-row .crumb-sub { color: var(--ink); }
@media (max-width: 900px) {
  .topbar-search { margin: 0 12px; }
}
.topbar-crumbs .crumb-jump { cursor: pointer; color: var(--muted); }
.topbar-crumbs .crumb-jump:hover { color: var(--ink); }
.topbar-crumbs .crumb-prefix { color: var(--muted-3); font-family: var(--font-mono); margin-right: 8px; user-select: none; }
.topbar-crumbs .crumb-sep { color: var(--muted-3); margin: 0 8px; }
.topbar-crumbs .crumb-current { color: var(--ink); font-weight: 600; }
.topbar-crumbs .crumb-sub { color: var(--ink); }

.topbar-actions { display: flex; align-items: center; gap: 10px; position: relative; margin-left: auto; }
.topbar-crumbs { flex: 1; }  /* Crumbs fuellen die Mitte, Actions rutschen rechts */
.topbar-company {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.topbar-company:hover { background: #e3e5e8; }
.topbar-company-avatar {
  width: 28px; height: 28px;
  background: var(--primary-dark);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar-company-info { line-height: 1.1; text-align: left; }
.topbar-company-info .name { font-size: 13px; font-weight: 600; color: var(--ink); }
.topbar-company-info .role { font-size: 11px; color: var(--muted); margin-top: 2px; }
.topbar-company-caret { color: var(--muted); margin-left: 2px; }

.company-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px -5px rgba(15,23,42,0.18);
  z-index: 70;
}
.company-menu.hidden { display: none; }
.company-menu-header {
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
}
.company-menu-header .name { font-weight: 600; font-size: 14px; }
.company-menu-header .role { color: var(--muted); font-size: 12px; margin-top: 2px; }
.company-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  font-size: 13px; color: var(--ink);
  border: none; background: none; width: 100%; text-align: left;
  cursor: pointer;
}
.company-menu-item:hover { background: var(--bg); }
.company-menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.company-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================================ SIDEBAR */
.sidebar {
  position: fixed; left: 0; top: var(--topbar-h);
  width: var(--sidebar-w);
  bottom: var(--assistant-h);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px;
  z-index: 50;
}
.sidebar-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--muted);
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.sidebar-btn:hover { background: var(--bg); color: var(--ink); }
.sidebar-btn.active { color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.sidebar-btn svg { width: 20px; height: 20px; }
.sidebar-btn .tip {
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  background: var(--primary-dark);
  color: #fff;
  padding: 4px 10px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  z-index: 80;
}
.sidebar-btn:hover .tip { opacity: 1; }
.sidebar-spacer { flex: 1; }

/* ============================================================ MAIN */
.main {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  top: var(--chrome-h);
  bottom: var(--assistant-h);
  overflow: hidden;
}

/* ============================================================ ZOOM 1 BOARD */
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  height: 100%;
  overflow: hidden;
}
.column {
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.column.drag-over {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-mid);
}
.column.drag-forbidden {
  border-color: var(--muted-2);
  background: var(--bg-2);
  opacity: 0.7;
}
.column.drag-forbidden .column-body::before {
  content: "Rückwärts nicht möglich";
  display: block;
  text-align: center;
  padding: 12px;
  font-size: 12px; color: var(--muted);
  border: 1px dashed var(--muted-2);
  margin-bottom: 10px;
}
.column-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 10px; flex-wrap: wrap;            /* schmale Spalten: Aktionen umbrechen statt abschneiden */
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.column-title {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;                               /* Titel darf schrumpfen/kürzen */
  font-size: 15px; font-weight: 700;
  color: var(--ink);
}
.column-header-actions { flex-wrap: wrap; }   /* Sortier-Select + „Matching-Agenten" dürfen umbrechen */
.agents-cta-compact { max-width: 100%; }      /* CTA-Button nie breiter als die Spalte */
.column-count {
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
}
.column-count.new {
  background: var(--accent-cyan);
  color: #fff;
  margin-left: 4px;
}
.column-header-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.active { color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.icon-btn svg { width: 16px; height: 16px; }

.column-subheader {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.column-subheader select {
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--ink);
}
.fav-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.fav-toggle:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.fav-toggle.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #fff;
}
.fav-toggle.active svg { color: #fff; }
.sub-select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  color: var(--ink);
  min-width: 0;
}

.column-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.column-body::-webkit-scrollbar { width: 6px; }
.column-body::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* ============================================================ CARD */
.card {
  background: #fafbfc;
  border: 1px solid var(--border);
  padding: 12px 14px 10px;
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  position: relative;
}
.card:hover {
  background: #fff;
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 10px -3px rgba(15,23,42,0.08);
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.4; }
.card.active-card {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
  box-shadow: 0 0 0 2px var(--accent-cyan-mid);
}
.card.is-new {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}
.card.is-new .card-new-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  color: #fff; background: var(--accent-cyan);
  padding: 2px 6px; letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* „+1"-Badge an der Board-Sidebar-Ikone (ungesehene Neuzugänge). */
.sidebar-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; box-sizing: border-box;
  padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-cyan); color: #fff;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; font-weight: 700; line-height: 1;
  pointer-events: none;
  animation: badgePop 0.22s ease;
}
@keyframes badgePop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Fly-to-Board: Geist-Element, das beim Verschieben zur Board-Ikone fliegt. */
.vf-fly {
  position: fixed; z-index: 200;
  background: var(--accent-cyan-soft, rgba(0,187,221,0.16));
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0.9;
  transition: transform 0.62s cubic-bezier(0.5, 0, 0.2, 1), opacity 0.62s ease;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 10px;
  padding-right: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
  font-size: 11px; color: var(--muted);
}
/* Auftraggeber-Name eigene Zeile + Ellipsis; Fristen-Pill bricht darunter um
   (statt rechts aus dem Kärtchen zu laufen). */
.card-meta > :first-child {
  flex: 1 1 100%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-deadline {
  display: inline-flex; align-items: center; gap: 4px;
  flex: 0 0 auto; white-space: nowrap;
  padding: 2px 6px;
  background: var(--bg-2);
  color: var(--muted);
}
/* Fristen-Pill im Kärtchen (Klasse .eig-deadline): nie breiter als das Kärtchen —
   notfalls schrumpft/klippt der Mini-Meter, statt rechts herauszulaufen. */
.card-meta .eig-deadline { flex: 0 1 auto; max-width: 100%; overflow: hidden; }
.card-deadline.urgent {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  font-weight: 600;
}
.card-deadline svg { width: 11px; height: 11px; }
.card-pid { font-family: ui-monospace, "SF Mono", monospace; font-size: 10px; color: var(--muted-2); }
.card-progress {
  height: 2px; background: var(--bg-2); margin-top: 10px; position: relative;
}
.card-progress > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-cyan);
}
.card-meta-actions {
  display: inline-flex;
  gap: 3px;
}
.card-action {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.card-action:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.card-action.danger:hover { border-color: var(--ink); color: var(--ink); }
.card-action svg { width: 11px; height: 11px; }
.card-fav {
  position: absolute;
  top: 10px; right: 10px;
  width: 20px; height: 20px;
  background: none; border: none;
  color: var(--muted-3);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.card-fav:hover { color: var(--accent-cyan); }
.card-fav.active { color: var(--accent-cyan); }
.card-fav svg { width: 14px; height: 14px; }

/* ============================================================ FOCUS (zoom 2) */
.focus-view { height: 100%; display: flex; flex-direction: column; }
.focus-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.focus-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 17px; font-weight: 700; color: var(--ink);
}
.focus-header-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 600;
  background: var(--accent-cyan); color: #fff;
  border: 1px solid var(--accent-cyan);
}
.btn:hover { background: var(--accent-cyan-hover); border-color: var(--accent-cyan-hover); }
.btn:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--bg); }
.btn.ghost { background: none; border: none; color: var(--muted); padding: 7px 10px; }
.btn.ghost:hover { background: var(--bg); color: var(--ink); }
.btn.dark { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.btn.dark:hover { background: var(--primary-dark-2); border-color: var(--primary-dark-2); }
.btn svg { width: 14px; height: 14px; }

.focus-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ---- Searchbar (Entdecken zoom 2) ---- */
.search-row {
  display: flex; align-items: stretch; gap: 10px;
  margin-bottom: 20px;
}
.searchbar {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--accent-cyan);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 0 0 3px var(--accent-cyan-mid);
}
.searchbar svg { width: 18px; height: 18px; color: var(--accent-cyan); flex-shrink: 0; }
.searchbar input {
  flex: 1;
  border: none; outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--ink);
}
.searchbar-tag {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  font-size: 11px; font-weight: 700;
  padding: 3px 8px;
  letter-spacing: 0.3px;
}
.agents-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-weight: 600; font-size: 13px;
  position: relative;
}
.agents-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.agents-btn svg { width: 16px; height: 16px; }
.agents-btn .dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--accent-cyan); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* ---- Tender rows ---- */
.tender-list { display: flex; flex-direction: column; gap: 8px; }
.tender-row {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tender-row:hover { border-color: var(--accent-cyan); box-shadow: 0 4px 12px -4px rgba(15,23,42,0.1); }
.tender-row .fav-btn {
  width: 24px; height: 24px;
  background: none; border: none;
  color: var(--muted-3);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.tender-row .fav-btn:hover { color: var(--accent-cyan); }
.tender-row .fav-btn.active { color: var(--accent-cyan); }
.tender-row .fav-btn svg { width: 16px; height: 16px; }
.tender-row-main { min-width: 0; }
.tender-row-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.tender-row-authority { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tender-row-meta {
  font-size: 12px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 14px;
}
.tender-row-meta .pid { font-family: ui-monospace, "SF Mono", monospace; font-size: 11px; color: var(--muted-2); }
.deadline-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: var(--bg-2);
  color: var(--ink);
  font-weight: 600;
}
.deadline-pill.urgent { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.tender-row-cta { display: flex; align-items: center; gap: 6px; }

/* ---- Analyse zoom 2 ---- */
.analyse-progress-cell { min-width: 160px; text-align: right; }
.analyse-progress-cell .bar { width: 140px; height: 4px; background: var(--bg-2); margin-left: auto; margin-bottom: 4px; }
.analyse-progress-cell .bar > span { display: block; height: 100%; background: var(--accent-cyan); }
.analyse-progress-cell .label { font-size: 11px; color: var(--muted); }

/* ---- Bewerbung zoom 2 ---- */
.bewerbung-cell { text-align: right; min-width: 160px; }
.bewerbung-cell .big { font-size: 22px; font-weight: 700; color: var(--accent-cyan); }
.bewerbung-cell .sub { font-size: 11px; color: var(--muted); }
.bewerbung-cell .missing strong { color: var(--ink); }

/* ============================================================ DETAIL (zoom 3) */
.detail-wrap {
  max-width: none;
}
.detail-main {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px 32px;
}
.detail-title { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.2; margin-bottom: 4px; }
.detail-title[data-open-workspace]:hover { color: var(--accent-cyan); }
.detail-authority { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.detail-meta-line {
  display: flex; flex-wrap: wrap; gap: 18px;
  padding: 12px 0; margin-bottom: 20px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.detail-meta-line .pid { font-family: ui-monospace, monospace; color: var(--muted-2); }
.detail-meta-line strong { color: var(--ink); font-weight: 600; }
.detail-section { margin-bottom: 28px; }
.detail-section h3 {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.4px;
}
.detail-section p { margin: 0 0 10px; color: var(--ink); line-height: 1.6; }
.detail-section ul { margin: 0 0 10px; padding-left: 18px; color: var(--ink); line-height: 1.8; }

.detail-summary-block {
  background: #fafbfc;
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-top: 24px;
}
.detail-summary-block h2 {
  margin: 0 0 12px; font-size: 16px; color: var(--ink);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.summary-section { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.summary-section:last-child { border-bottom: none; }
.summary-section h4 { margin: 0 0 4px; font-size: 13px; color: var(--ink); }
.summary-section p { margin: 0 0 6px; font-size: 13px; color: var(--ink); line-height: 1.6; }
.detail-source {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--accent-cyan);
  cursor: pointer;
}
.detail-source:hover { text-decoration: underline; }
.detail-source svg { width: 11px; height: 11px; }

.share-bar {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; flex-wrap: wrap;
}

/* ---- Dokumente-Liste ---- */
.doc-list { display: flex; flex-direction: column; gap: 4px; }
.doc-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.doc-item:hover { border-color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.doc-icon {
  width: 36px; height: 36px;
  background: var(--bg-2); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.doc-name { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-cat  { font-size: 11px; color: var(--muted); }
.doc-size { font-size: 11px; color: var(--muted); }

/* ---- Required docs (Bewerbung) ---- */
.req-list { display: flex; flex-direction: column; gap: 4px; }
.req-item {
  display: grid; grid-template-columns: 20px 1fr auto; gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.req-item.fulfilled { background: var(--accent-cyan-soft); border-color: var(--accent-cyan-mid); }
.req-check { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.req-check.fulfilled { color: var(--accent-cyan); }
.req-check.missing   { color: var(--muted-2); }
.req-label { font-size: 13px; color: var(--ink); }
.req-item.fulfilled .req-label { color: var(--accent-cyan); }
.req-action {
  font-size: 11px; color: var(--accent-cyan); text-transform: uppercase;
  font-weight: 700; letter-spacing: 0.3px;
  background: none; border: none;
}
.req-action:hover { text-decoration: underline; }

/* ---- Upload / Drive ---- */
.upload-zone {
  border: 2px dashed var(--border-strong);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
  margin: 12px 0;
}
.upload-zone strong { color: var(--accent-cyan); font-weight: 600; }
.drive-list { display: flex; flex-direction: column; gap: 6px; }
.drive-row {
  display: grid; grid-template-columns: 36px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
}
.drive-row-name { font-size: 13px; font-weight: 600; }
.drive-row-meta { font-size: 11px; color: var(--muted); }

/* ---- Vergabestelle-Link (Abgabemanager) ---- */
.abgabe-card {
  background: var(--primary-dark);
  color: #fff;
  padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}
.abgabe-card strong { display: block; font-size: 14px; margin-bottom: 2px; }
.abgabe-card span { font-size: 12px; opacity: 0.8; }
.abgabe-card .btn { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #fff; }

/* ============================================================ READER (zoom 3 Entdecken/Analyse docs) */
.reader-wrap {
  display: grid;
  grid-template-columns: 23.6fr 76.4fr;
  gap: 14px;
  height: 100%;
}
.reader-wrap.side-right {
  grid-template-columns: 76.4fr 23.6fr;
}
.reader-side {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.reader-side h4 { margin: 0 0 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.reader-file {
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 12px;
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center;
  cursor: pointer;
}
.reader-file:hover { border-color: var(--accent-cyan); }
.reader-file.active { background: var(--accent-cyan-soft); border-color: var(--accent-cyan); color: var(--accent-cyan); }
.reader-file .doc-icon { width: 28px; height: 28px; font-size: 9px; }
.reader-file-name { font-weight: 600; }
.reader-file-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }

.reader-main {
  background: var(--bg-2);
  overflow-y: auto;
  display: flex; flex-direction: column;
  min-height: 0;
}
.reader-toolbar {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 12px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
}
.reader-pages {
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.reader-toolbar .label { font-size: 12px; color: var(--muted); }
.reader-toolbar .spacer { flex: 1; }
.reader-toolbar .tool-btn {
  height: 30px; padding: 0 10px;
  background: none; border: 1px solid transparent;
  font-size: 12px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 4px;
}
.reader-toolbar .tool-btn:hover { background: var(--bg); }
.reader-toolbar .tool-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.reader-toolbar .tool-btn svg { width: 12px; height: 12px; }
.reader-toolbar .tool-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.reader-page {
  max-width: 720px; margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 56px 68px;
  min-height: 800px;
  font-size: 13px; line-height: 1.75;
  color: var(--ink);
  position: relative;
}
.reader-page h1 { font-size: 18px; font-weight: 700; margin-top: 0; }
.reader-page h2 { font-size: 14px; margin-top: 22px; }
.reader-page .form-field {
  display: inline-block; min-width: 200px;
  border-bottom: 1px solid var(--ink);
  padding: 0 4px; outline: none;
  background: var(--accent-cyan-soft);
}
.reader-page .form-field:focus { background: var(--accent-cyan-mid); }
.reader-page .stamp {
  position: absolute;
  width: 140px; height: 140px;
  border: 3px solid var(--accent-cyan);
  color: var(--accent-cyan);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.3px;
  transform: rotate(-8deg);
  opacity: 0.85;
  pointer-events: none;
  text-transform: uppercase;
}
.reader-page .stamp small { display: block; font-size: 9px; font-weight: 500; margin-top: 4px; }
.reader-page .signature {
  position: absolute;
  font-family: "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 26px; color: var(--ink);
  pointer-events: none;
}
.reader-page .added-text {
  position: absolute;
  padding: 2px 4px;
  background: var(--accent-cyan-soft);
}

/* ============================================================ MODAL */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  width: 100%; max-width: 860px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal.small { max-width: 480px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-close {
  width: 32px; height: 32px;
  background: none; border: none;
  color: var(--muted); font-size: 18px;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  padding: 0 12px;
}
.modal-tab {
  padding: 12px 18px;
  background: none; border: none;
  font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.modal-tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}

/* form grid */
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
.form-grid.one-col { grid-template-columns: 1fr; }
.field label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px; color: var(--ink);
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-mid);
}
.field textarea { min-height: 80px; resize: vertical; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-top: 8px;
}
.section-head h3 { font-size: 14px; margin: 0; color: var(--ink); }
.section-head p  { margin: 0; font-size: 12px; color: var(--muted); }

.import-box {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--accent-cyan-mid);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.import-box .text { font-size: 13px; color: var(--ink); }
.import-box .text strong { color: var(--accent-cyan); }

/* ---- Users table ---- */
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 700; letter-spacing: 0.3px;
}
.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table td select {
  padding: 5px 8px; border: 1px solid var(--border); background: #fff; font-size: 12px;
}
.role-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; letter-spacing: 0.3px;
}
.role-badge.owner    { background: var(--primary-dark); color: #fff; }
.role-badge.admin    { background: var(--accent-cyan); color: #fff; }
.role-badge.editor   { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.role-badge.reviewer { background: var(--bg-2); color: var(--muted); }
.role-badge.viewer   { background: #fff; color: var(--muted); border: 1px solid var(--border); }
.role-badge.pending  { background: #fff; color: var(--muted); border: 1px dashed var(--border-strong); }
.user-status-pending { font-size: 11px; color: var(--muted); font-style: italic; }

/* ---- Plan ---- */
.plan-card {
  background: var(--primary-dark);
  color: #fff;
  padding: 24px;
  margin-bottom: 20px;
}
.plan-card h3 { margin: 0 0 4px; font-size: 20px; }
.plan-card .price { font-size: 28px; font-weight: 700; margin: 12px 0 4px; color: var(--accent-cyan); }
.plan-card .cycle { font-size: 12px; opacity: 0.75; }
.usage-row { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.usage-row:last-child { border-bottom: none; }
.usage-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.usage-bar { height: 4px; background: var(--bg-2); }
.usage-bar > span { display: block; height: 100%; background: var(--accent-cyan); }

/* ---- Knowledge base ---- */
.kb-list { display: flex; flex-direction: column; gap: 6px; }
.kb-item {
  display: grid; grid-template-columns: 36px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
}
.kb-item-name { font-weight: 600; }
.kb-item-meta { font-size: 11px; color: var(--muted); }

/* ---- Search Agents ---- */
.agent-list { display: flex; flex-direction: column; gap: 8px; }
.agent-item {
  border: 1px solid var(--border);
  padding: 14px 16px;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px; align-items: center;
}
.agent-item-name { font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.agent-item-filters { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.agent-item-stats { font-size: 11px; color: var(--muted); }
.agent-item-stats strong { color: var(--accent-cyan); }
.agent-status {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 3px 8px;
}
.agent-status.active   { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.agent-status.paused   { background: var(--bg-2); color: var(--muted); }

/* ============================================================ ASSISTANT BAR */
.assistant {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  min-height: var(--assistant-h);
  display: flex; justify-content: center; align-items: flex-end;
  padding: 12px 20px;
  z-index: 55;
}
.assistant-inner {
  width: 100%;
  max-width: 720px;
  display: flex; align-items: flex-end; gap: 10px;
}
.assistant-avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.assistant-avatar img { width: 34px; height: 34px; object-fit: contain; }
.assistant-input-wrap {
  flex: 1;
  display: flex; align-items: flex-end; gap: 8px;
  border: 1px solid var(--border-strong);
  padding: 8px 10px 8px 14px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.assistant-input-wrap:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-mid);
}
.assistant-input-wrap textarea {
  flex: 1;
  border: none; outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  resize: none;
  min-height: 22px;
  max-height: 140px;
  line-height: 1.5;
  padding: 2px 0;
  overflow-y: auto;
  font-family: inherit;
}
.assistant-input-wrap textarea::placeholder { color: var(--muted-2); }
.assistant-iconbtn {
  width: 28px; height: 28px;
  background: none; border: none;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.assistant-iconbtn:hover { background: var(--bg); color: var(--ink); }
.assistant-iconbtn svg { width: 14px; height: 14px; }
.assistant-send {
  width: 40px; height: 40px;
  background: var(--accent-cyan); color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.assistant-send:hover { background: var(--accent-cyan-hover); }
.assistant-send:disabled { background: var(--border-strong); cursor: not-allowed; }
.assistant-send svg { width: 16px; height: 16px; }

/* Chat panel */
.chat-panel {
  position: fixed; bottom: var(--assistant-h); left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 720px;
  height: 480px;
  max-height: calc(100vh - var(--assistant-h) - var(--topbar-h) - 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -10px 30px -10px rgba(0,0,0,0.12);
  z-index: 56;
  display: flex; flex-direction: column;
}
.chat-panel.hidden { display: none; }
.chat-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
  background: #fafbfc;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { font-size: 13px; line-height: 1.55; max-width: 85%; padding: 8px 12px; }
.chat-msg.user { align-self: flex-end; background: var(--primary-dark); color: #fff; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-2); color: var(--ink); }
.chat-msg strong { font-weight: 700; }
.chat-msg em { font-style: italic; }

/* ============================================================ ZOOM SWITCH */
.zoom-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  background: #fff;
  height: 28px;
  overflow: hidden;
}
.zoom-switch-btn {
  width: 28px; height: 100%;
  background: none; border: none;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--border);
}
.zoom-switch-btn:last-child { border-right: none; }
.zoom-switch-btn.active { background: var(--primary-dark); color: #fff; }
.zoom-switch-btn svg { width: 14px; height: 14px; }
.zoom-switch-btn:not(.active):hover { background: var(--bg); color: var(--ink); }

/* ============================================================ CLOSE BUTTON (focus header) */
.close-btn {
  width: 30px; height: 30px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.close-btn:hover { border-color: var(--ink); color: var(--ink); }
.close-btn svg { width: 14px; height: 14px; }

/* ============================================================ SOURCE BUTTON (primary cyan link) */
.source-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--accent-cyan);
  color: #fff;
  font-weight: 600; font-size: 13px;
  border: none; text-decoration: none;
}
.source-btn:hover { background: var(--accent-cyan-hover); color: #fff; text-decoration: none; }
.source-btn svg { width: 14px; height: 14px; }

/* ============================================================ DASHBOARD */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }

/* Auswertungen-Kennzahlen (Aktive Vorgänge / Gewonnen / Verloren / Erfolgsquote).
   Grid hier in CSS (NICHT inline in auswertungen.js) — sonst gewinnt der Inline-Stil
   gegen die Media-Queries und die Kacheln blieben auf Mobile 4-spaltig (4. abgeschnitten). */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.dash-card {
  background: #fff;
  border: 1px solid var(--border);
  padding: 18px 20px;
}
.dash-card .label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700;
}
.dash-card .value { font-size: 28px; font-weight: 700; color: var(--ink); margin-top: 6px; line-height: 1; }
.dash-card .delta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.dash-card .delta.cyan { color: var(--accent-cyan); }
.dash-row {
  display: grid;
  grid-template-columns: 61.8fr 38.2fr; /* goldener Schnitt */
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .dash-row { grid-template-columns: 1fr; } }
.dash-block {
  background: #fff; border: 1px solid var(--border);
  padding: 18px 20px;
}
.dash-block h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.dash-list { display: flex; flex-direction: column; }
.dash-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item .num { color: var(--muted); font-weight: 600; }
.dash-usage-row { margin-bottom: 10px; }
.dash-usage-row .head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.dash-usage-row .head .limit { color: var(--muted); }
.dash-usage-row .bar { height: 4px; background: var(--bg-2); }
.dash-usage-row .bar > span { display: block; height: 100%; background: var(--accent-cyan); }

/* ============================================================ PLANS SELECTOR */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.plan-option {
  border: 1px solid var(--border);
  padding: 18px 20px;
  cursor: pointer;
  background: #fff;
  display: flex; flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-option:hover { border-color: var(--accent-cyan); }
.plan-option.current { border-color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.plan-option .name { font-weight: 700; font-size: 14px; }
.plan-option .price { font-size: 26px; font-weight: 700; color: var(--ink); margin: 10px 0 2px; }
.plan-option .cycle { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.plan-option .limits { font-size: 12px; color: var(--muted); line-height: 1.8; }
.plan-option .current-badge {
  display: inline-block; margin-top: 12px; align-self: flex-start;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; background: var(--accent-cyan); color: #fff;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.plan-option .switch-badge {
  display: inline-block; margin-top: 12px; align-self: flex-start;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; background: var(--bg-2); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* ============================================================ V2: Detail-View common */
.detail-pitch {
  margin: 14px 0 22px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 720px;
}
.detail-primary-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.btn.primary-lg { padding: 12px 22px; font-size: 14px; }
details.detail-collapsible {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}
details.detail-collapsible > summary {
  cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  list-style: none;
  padding: 4px 0;
  display: flex; justify-content: space-between; align-items: center;
}
details.detail-collapsible > summary::-webkit-details-marker { display: none; }
details.detail-collapsible > summary::after {
  content: "\203A";
  font-size: 18px; display: inline-block; transition: transform 0.2s; color: var(--muted-2); font-weight: 400;
}
details.detail-collapsible[open] > summary::after { content: "\203A"; transform: rotate(90deg); }
details.detail-collapsible > summary:hover { color: var(--ink); }

/* ============================================================ V2: Entscheidungskarte */
.verdict-card {
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 28px 32px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 36px;
}
.verdict-card.positive { border-color: var(--accent-cyan); background: linear-gradient(180deg, var(--accent-cyan-soft) 0%, #ffffff 140px); }
.verdict-card.negative { border-color: var(--ink); }
.verdict-card.neutral  { border-color: var(--muted-2); }
.verdict-head {
  grid-column: 1 / -1;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.verdict-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 8px;
}
.verdict-word {
  font-size: 38px; font-weight: 700; line-height: 1.05;
  letter-spacing: -0.5px;
}
.verdict-word.positive { color: var(--accent-cyan); }
.verdict-word.negative { color: var(--ink); }
.verdict-word.neutral  { color: var(--muted); }
.verdict-reasoning {
  font-size: 15px; color: var(--ink); line-height: 1.55;
  margin-top: 10px; max-width: 640px;
}
.verdict-column h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); font-weight: 700; margin: 0 0 10px;
}
.verdict-list { margin: 0; padding: 0; list-style: none; }
.verdict-list li {
  padding: 8px 0;
  font-size: 13px; color: var(--ink);
  display: flex; gap: 10px;
  line-height: 1.5;
  border-bottom: 1px dashed var(--border);
}
.verdict-list li:last-child { border-bottom: none; }
.verdict-list.strengths li::before { content: "＋"; color: var(--accent-cyan); font-weight: 700; flex-shrink: 0; }
.verdict-list.risks     li::before { content: "！"; color: var(--ink); font-weight: 700; flex-shrink: 0; }
.verdict-actions {
  grid-column: 1 / -1;
  display: flex; gap: 10px; flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Analyse running */
.analyse-running {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  margin-bottom: 20px;
}
.analyse-running-head {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.analyse-running-dot {
  width: 10px; height: 10px; background: var(--accent-cyan);
  animation: pulseCyan 1.4s ease-in-out infinite;
}
.analyse-running-bar {
  height: 4px; background: var(--bg-2);
  margin-bottom: 14px;
}
.analyse-running-bar > span {
  display: block; height: 100%; background: var(--accent-cyan);
  transition: width 0.4s ease;
}
.analyse-running-hint { font-size: 12px; color: var(--muted); }

/* No-Bid reasons */
.reasons-list { display: flex; flex-direction: column; }
.reason-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.reason-option:has(input:checked) {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}
.reason-option + .reason-option { border-top: none; }
.reason-option input[type="radio"] { accent-color: var(--accent-cyan); }

/* Archiv reason */
.archiv-reason {
  font-size: 11px; color: var(--muted);
  background: var(--bg-2);
  padding: 4px 8px;
  margin: 6px 0 8px;
}

/* ============================================================ V2: Briefing */
.briefing-head {
  background: var(--primary-dark);
  color: #fff;
  padding: 24px 28px;
  margin-bottom: 24px;
}
.briefing-head-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.briefing-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--accent-cyan);
}
.briefing-date { font-size: 11px; opacity: 0.65; }
.briefing-expose {
  font-size: 15px; line-height: 1.6;
  margin-bottom: 20px;
  max-width: 640px;
}
.briefing-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.briefing-stat-value {
  font-size: 28px; font-weight: 700; line-height: 1;
  color: var(--accent-cyan);
}
.briefing-stat-value span {
  font-size: 14px; color: rgba(255,255,255,0.6); font-weight: 400;
  margin-left: 2px;
}
.briefing-stat-value.urgent { color: #fff; }
.briefing-stat-label {
  font-size: 11px; color: rgba(255,255,255,0.65);
  text-transform: uppercase; letter-spacing: 0.3px;
  margin-top: 6px;
}
.briefing-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.briefing-section-head h3 {
  margin: 0; font-size: 14px;
  color: var(--ink); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700;
}

/* Task rows */
.task-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.task-row {
  display: grid;
  grid-template-columns: 28px 1fr 180px;
  gap: 14px; align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.task-row.task-done { background: #fafbfc; }
.task-row.task-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted-2); }
.task-row.task-in_progress {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}
.task-row.task-blocked {
  border-color: var(--ink);
  background: var(--bg-2);
}
.task-status-btn {
  width: 28px; height: 28px;
  background: none; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
}
.task-status-btn.done       { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.task-status-btn.in_progress{ border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--accent-cyan-soft); }
.task-status-btn.blocked    { border-color: var(--ink); color: var(--ink); }
.task-status-btn svg { width: 12px; height: 12px; }
.task-title { font-size: 13px; font-weight: 600; }
.task-title .task-optional {
  font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px;
  margin-left: 8px;
  padding: 1px 6px; background: var(--bg-2);
}
.task-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.task-meta .urgent { color: var(--ink); font-weight: 700; }
.task-owner {
  padding: 5px 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
}

/* Submit gate */
.submit-gate {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 18px 22px;
  margin: 24px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px; align-items: center;
}
.submit-gate.ready {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
}
.submit-gate-text { font-size: 13px; color: var(--ink); line-height: 1.5; }
.submit-gate.ready .submit-gate-text strong { color: var(--accent-cyan); }
.submit-gate-actions { display: flex; gap: 8px; }
.btn.disabled, .btn:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; color: #fff; }

/* ============================================================ V2: History */
.history-timeline {
  display: flex; flex-direction: column;
  padding: 8px 0;
}
.history-entry {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.history-entry:last-child { border-bottom: none; }
.history-date { color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.history-content strong { color: var(--ink); font-weight: 600; }
.history-actor { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ============================================================ V2: Onboarding */
.onboarding-overlay {
  position: fixed; inset: 0;
  background: rgba(248, 249, 250, 0.98);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.onboarding-panel {
  background: #fff;
  border: 1px solid var(--border);
  padding: 44px 48px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(15,23,42,0.2);
}
.onboarding-step {
  font-size: 11px; font-weight: 700; color: var(--accent-cyan);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.onboarding-panel h1 {
  font-size: 28px; margin: 0 0 10px; color: var(--ink); font-weight: 700;
}
.onboarding-lead {
  font-size: 15px; color: var(--muted); line-height: 1.55;
  margin: 0 0 28px;
  max-width: 560px;
}
.onboarding-hero {
  background: var(--accent-cyan-soft);
  border: 1px solid var(--accent-cyan-mid);
  padding: 18px 22px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}
.onboarding-sub {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}
.onboarding-expl { font-size: 13px; color: var(--ink); margin: 0; line-height: 1.5; }
.onboarding-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}

/* ============================================================ HELPERS */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.archiv-placeholder { padding: 40px; text-align: center; color: var(--muted); }
.kbd {
  display: inline-block;
  padding: 1px 6px; border: 1px solid var(--border-strong); background: #fafbfc;
  font-size: 11px; font-family: ui-monospace, monospace;
}
.pulse-cyan { animation: pulseCyan 1.4s ease-in-out infinite; }
@keyframes pulseCyan {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-cyan-mid); }
  50%      { box-shadow: 0 0 0 8px rgba(0,187,221,0); }
}
.toast {
  position: fixed; bottom: calc(var(--assistant-h) + 24px); right: 24px;
  transform: translateY(8px);
  background: var(--primary-dark); color: #fff;
  padding: 10px 18px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ============================================================ BOARD SPLIT (Trello-style) */
.board-split {
  height: 100%; display: flex; flex-direction: column; overflow: hidden;
}
.board-split-body {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}
.board-split-columns {
  flex: 1; overflow-x: auto; overflow-y: hidden;
  min-width: 0;
  /* „none" (NICHT nur „contain"): unterbindet zusätzlich den lokalen
     Rubber-Band-/Bounce-Effekt — beim Scrollen über die letzte Spalte hinaus
     federte es sonst ins Leere und sprang zurück (Trackpad/Touch) und löste die
     Browser-Zurück-Geste aus. Der Scroll endet jetzt hart an der letzten Spalte. */
  overscroll-behavior-x: none;
  transition: flex 0.25s ease;
}
.board-split-columns .board {
  height: 100%;
  display: flex;
  gap: 12px;
  padding: 12px;
  min-width: 0;
}
/* Die 4 Spalten teilen sich die Breite gleichmäßig und dürfen schrumpfen
   (min-width:0) — so läuft das Board NIE rechts über, egal ob das Detail-Panel
   offen ist. Mobile schaltet weiter unten auf Wisch-Modus um. */
.board-split-columns .board .column {
  flex: 1 1 0;
  min-width: 0;
}
.board-split-detail {
  width: 0;
  overflow: hidden;
  transition: width 0.25s ease;
  border-left: 2px solid var(--border);
  background: var(--surface);
}
.board-split-detail.open {
  width: 38.2%; /* goldener Schnitt — Board behält mehr Platz */
  min-width: 400px;
  overflow-y: auto;
}
.board-split-detail-inner {
  padding: 20px 24px 40px;
}
.board-split-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  position: sticky; top: 0; z-index: 5;
}
.board-split-detail-header .column-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted);
}

/* ============================================================ FLYOUT CARD ANIMATION */
.flyout-card {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 2px solid var(--accent-cyan);
  padding: 10px 14px;
  box-shadow: 0 12px 40px -8px rgba(0,0,0,0.25);
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 320px;
  overflow: hidden;
}
.flyout-card .flyout-title {
  font-size: 12px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.flyout-card .flyout-meta {
  font-size: 10px; color: var(--muted); margin-top: 2px;
}
.flyout-card.flying {
  transform: scale(0.3);
  opacity: 0;
}
.flyout-card.to-archiv {
  border-color: var(--muted-2);
}

/* Sidebar icon pulse when card arrives */
@keyframes sidebarPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); background: var(--accent-cyan); color: #fff; }
  100% { transform: scale(1); }
}
.sidebar-btn.pulse-receive {
  animation: sidebarPulse 0.4s ease;
}

/* ============================================================ WORKSPACE (fullscreen 3-col) */
.workspace {
  position: fixed; inset: 0;
  top: var(--chrome-h);
  left: var(--sidebar-w);
  z-index: 65;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.workspace-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  height: 42px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.workspace-topbar-actions { display: flex; align-items: center; gap: 6px; }
.workspace-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
}
.workspace-breadcrumb svg { width: 13px; height: 13px; }
.wb-link { cursor: pointer; color: var(--muted); transition: color 0.12s; }
.wb-link:hover { color: var(--ink); }
.wb-sep { color: var(--muted-3); font-size: 11px; }
.wb-current { color: var(--ink); font-weight: 600; }
.workspace-body {
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 61.8fr) 38.2fr;
  overflow: hidden;
}
/* Ohne „Roten Faden": nur Detail + Diskussion. */
.workspace--no-nav .workspace-body { grid-template-columns: minmax(0, 61.8fr) 38.2fr; }
.workspace-nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
}
.workspace-nav-header {
  padding: 0 16px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.workspace-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-size: 12px; color: var(--ink);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.workspace-nav-item:hover { background: var(--bg); }
.workspace-nav-item.active { background: var(--accent-cyan-soft); color: var(--accent-cyan); font-weight: 600; }
.workspace-nav-item .nav-check {
  width: 16px; height: 16px;
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 10px;
}
.workspace-nav-item .nav-check.done { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--accent-cyan-soft); }
/* Phasen sind reine Statusanzeige, keine Schaltflächen: kein Hover, kein gefüllter
   Hintergrund (auch nicht bei der aktiven Phase), kein Klick-Cursor. */
.workspace-nav-item.workspace-nav-phase { cursor: default; }
.workspace-nav-item.workspace-nav-phase:hover { background: none; }
.workspace-nav-item.workspace-nav-phase.active { background: none; }
/* Noch ausstehende Phasen (nach der aktuellen) ausgegraut. */
.workspace-nav-item.pending { color: var(--muted-2); }
.workspace-nav-item.pending .nav-check { border-color: var(--border); color: var(--muted-2); }
.workspace-nav-section {
  padding: 12px 16px 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted-2);
}

.workspace-main {
  overflow-y: auto;
  padding: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.workspace-main-inner { padding: 28px 32px 60px; }

/* Rendered documents (mammoth docx HTML / SheetJS tables) */
.doc-rendered { font-size: 14px; line-height: 1.6; color: var(--ink); }
.doc-rendered h1, .doc-rendered h2, .doc-rendered h3, .doc-rendered h4 { color: var(--ink); margin: 14px 0 6px; line-height: 1.3; }
.doc-rendered p { margin: 0 0 10px; }
.doc-rendered ul, .doc-rendered ol { margin: 0 0 10px; padding-left: 22px; }
.doc-rendered img { max-width: 100%; height: auto; }
.doc-rendered table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.doc-rendered td, .doc-rendered th { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.doc-rendered th { background: var(--bg-2); font-weight: 600; }
.doc-xls { overflow-x: auto; }

/* Markdown-Tabellen in der Detail-/Workspace-Ansicht: nie über den Rand laufen.
   display:block + overflow-x macht breite Tabellen horizontal scrollbar (statt
   abgeschnitten); lange Zellinhalte brechen um. Greift in Suche, Board & Workspace. */
.detail-wrap table, .detail-section table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-wrap td, .detail-wrap th,
.detail-section td, .detail-section th { word-break: break-word; }

/* docx-preview: seitengetreue Darstellung in einem scrollbaren Rahmen (wie die PDF-Ansicht) */
.doc-docx { overflow: auto; max-height: 82vh; border: 1px solid var(--border); background: #f3f4f5; }
.doc-docx .docxv-wrapper { background: transparent; padding: 16px; }
.doc-docx .docxv-wrapper > section.docxv { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.12); margin: 0 auto 16px; }

.workspace-comments {
  background: #fafbfc;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.workspace-comments-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.workspace-comments-body {
  flex: 1; overflow-y: auto;
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.workspace-comments-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.workspace-comments-input input[type="text"],
.workspace-comments-input input[data-thread-reply] {
  flex: 1; border: 1px solid var(--border); padding: 10px 12px;
  font-size: 13px; font-family: inherit; outline: none;
  background: #fff; color: var(--ink);
}
.workspace-comments-input input:focus { border-color: var(--accent-cyan); box-shadow: 0 0 0 2px var(--accent-cyan-mid); }

/* ============================================================ TENDER-OVERLAY (Milchglas-Workspace)
   Popup über der Quell-View: geblurrter Backdrop lässt die darunterliegende
   Ansicht durchscheinen; das Panel selbst ist milchglas-transluzent. Zwei
   Spalten: Detail (links, scrollbar + Triage-Footer) und Diskussion (rechts). */
.ws-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
}
.ws-overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(18, 28, 36, 0.34);
  backdrop-filter: blur(3px) saturate(120%);
  -webkit-backdrop-filter: blur(3px) saturate(120%);
  opacity: 0; transition: opacity 0.22s ease;
}
.ws-overlay.is-open .ws-overlay-backdrop { opacity: 1; }
.ws-overlay-panel {
  position: relative; z-index: 1;
  width: min(1400px, 94vw); height: min(880px, 92vh);
  display: flex; flex-direction: column;
  /* Panel scrollt → KEIN backdrop-filter hier (das war der Performance-Killer:
     pro Scroll-Frame Vollflächen-Blur neu berechnet). Milchglas-Anmutung kommt
     vom Backdrop ringsum; das Panel selbst ist nur leicht transluzent. */
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 30px 90px -24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(0.99);
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.ws-overlay.is-open .ws-overlay-panel { opacity: 1; transform: translateY(0) scale(1); }
.ws-overlay-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.ws-overlay-close:hover { color: var(--ink); border-color: var(--accent-cyan); background: #fff; }
.ws-overlay-close svg { width: 18px; height: 18px; }
.ws-overlay-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 61.8fr) 38.2fr;
  overflow: hidden;
}
.ws-overlay-main {
  display: flex; flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}
.ws-overlay-detail { flex: 1; overflow-y: auto; background: var(--bg); }
/* Detail als Karten auf hellgrauem Grund: Boxen + Abstände wirken weniger flach,
   und die Akzentfarben lesen sauber auf weißen Karten statt auf dem Milchglas. */
.ws-overlay-detail .detail-wrap {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px;
}
.ws-overlay-detail .detail-head,
.ws-overlay-detail .detail-section,
.ws-overlay-detail details.detail-collapsible,
.ws-overlay-detail .detail-documents {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 20px;
  margin: 0;
}
/* Eckdaten-Zeile in der Kopf-Karte: nur dezenter Trenner oben, kein Doppelrahmen. */
.ws-overlay-detail .detail-meta-line {
  border-bottom: none; margin: 10px 0 0; padding: 10px 0 0;
}
.ws-overlay-detail .detail-documents { margin-top: 0; }
.ws-overlay-comments {
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  background: rgba(250, 251, 252, 0.6);
}
/* Triage-Footer: fünf Bewertungsstufen + zwei Entscheidungs-Buttons. */
.ws-overlay-actions {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}
/* Footer: schlicht — Überschrift „Vorentscheidung treffen" + die beiden Buttons darunter. */
.wso-triage {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 20px;
}
.wso-triage-q { font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.4px; }
.wso-triage-decide-btns { display: flex; align-items: center; gap: 10px; }
.wso-triage .da-btn { flex: 1; justify-content: center; height: 46px; padding: 0 24px; font-size: 14.5px; }
.wso-triage .da-btn-ghost { border: 1px solid var(--border); }
.wso-triage .da-btn-primary { box-shadow: 0 2px 10px -2px rgba(0,187,221,0.5); }

/* „Wie gut passt das?" — Survey-/Likert-Slider unter der Kurzbeschreibung. */
.detail-rating:empty { display: none; }

/* Bewertung wirkt optional: kleiner, gedämpft, durch dünnen Trenner an den
   Box-Inhalt darüber angehängt (Haupt-Slider in der Kurzbeschreibungs-Box,
   Section-Slider unter dem jeweiligen Section-Text). */
.detail-rating--inline { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }

.fit-rating { display: flex; flex-direction: column; gap: 5px; }
.fit-rating-q { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
/* Die Mausfläche ist die VOLLE Slider-Höhe (22px transparent), die sichtbare
   Linie ist nur der 4px-Track — so kann man überall greifen, nicht nur am Strich. */
.fit-rating-track { position: relative; height: 22px; }
.fit-rating-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0;
  background: transparent; outline: none; cursor: pointer; display: block;
}
.fit-rating-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #c2ccd4, var(--accent-cyan));
}
.fit-rating-slider::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #c2ccd4, var(--accent-cyan));
}
.fit-rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px;
  background: var(--accent-cyan); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer; border-radius: 50%;
}
.fit-rating-slider::-moz-range-thumb {
  width: 14px; height: 14px; background: var(--accent-cyan);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer; border-radius: 50%;
}
/* Fünf Tick-Marken an den Likert-Positionen, mittig am 4px-Track. */
.fit-rating-ticks {
  position: absolute; left: 7px; right: 7px; top: 8px;
  display: flex; justify-content: space-between; pointer-events: none;
}
.fit-rating-ticks span { width: 2px; height: 6px; background: var(--border-strong); }
/* Hinweis-Box vor „Kandidat": dezent. */
.detail-locked { font-size: 12.5px; color: var(--muted); font-style: italic; padding: 2px 0; }
.fit-rating-scale {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10.5px; color: var(--muted-2);
}
.fit-rating-value { font-size: 11.5px; font-weight: 700; color: var(--accent-cyan-hover); }

/* Section-Header: Label links, gewählte „passt"-Einschätzung rechts (auch zugeklappt). */
.detail-collapsible > summary .sec-label { flex: 1; }
.detail-collapsible > summary .sec-fit {
  font-size: 11px; font-weight: 700; color: var(--accent-cyan-hover);
  text-transform: none; letter-spacing: 0; margin-right: 8px; white-space: nowrap;
}

/* Dünner Diskussions-Platzhalter, solange noch kein Vorgang existiert. */
.wso-disc-empty {
  padding: 22px 18px;
  font-size: 12px; font-weight: 300; line-height: 1.5;
  color: var(--muted-2);
}

@media (max-width: 1024px) {
  .ws-overlay { padding: 0; }
  .ws-overlay-panel { width: 100vw; height: 100%; }
  .ws-overlay-body { grid-template-columns: 1fr; overflow-y: auto; }
  .ws-overlay-main { border-right: none; overflow: visible; }
  .ws-overlay-detail { overflow: visible; }
  .ws-overlay-comments { border-top: 1px solid var(--border); min-height: 320px; }
}

/* ============================================================ KLÄRUNGSBEDARF THREADS */
.kb-card {
  border: 1px solid var(--border); background: #fff; margin-bottom: 6px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.kb-card:hover { border-color: var(--accent-cyan); box-shadow: 0 2px 8px -2px rgba(0,0,0,0.1); }
.kb-card.kb-resolved { opacity: 0.5; border-style: dashed; cursor: default; }
.kb-card.kb-resolved:hover { border-color: var(--border); box-shadow: none; }
.kb-card.kb-mine { border-left: 3px solid var(--accent-cyan); }
.kb-card-header { padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.kb-card-avatar {
  width: 22px; height: 22px; flex-shrink: 0;
  background: var(--primary-dark); color: #fff;
  font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.kb-card-avatar.vf { background: var(--accent-cyan); }
.kb-card-body { flex: 1; min-width: 0; }
.kb-card-title { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.kb-card-preview { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-card.kb-resolved .kb-card-title { font-weight: 400; color: var(--muted); text-decoration: line-through; font-size: 11px; }
.kb-card.kb-resolved .kb-card-preview { display: none; }
.kb-status { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; padding: 2px 6px; flex-shrink: 0; }
.kb-status.offen { background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.kb-status.geklaert { background: var(--bg-2); color: var(--tiefsee); }
.kb-status.wartet { background: var(--bg-2); color: var(--muted); }

.kb-message { padding: 6px 0; display: flex; gap: 8px; }
.kb-message + .kb-message { border-top: 1px solid var(--border); }
.kb-message.kb-grouped { padding-top: 2px; border-top: none; }
.kb-message.kb-grouped .kb-msg-avatar { visibility: hidden; height: 0; }
.kb-message.kb-grouped .kb-msg-author { display: none; }
.kb-msg-avatar {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--primary-dark); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.kb-msg-avatar.vf { background: var(--accent-cyan); }
.kb-msg-body { flex: 1; min-width: 0; }
.kb-msg-author { font-size: 11px; font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.kb-msg-author .time { font-weight: 400; color: var(--muted-2); margin-left: 6px; font-size: 10px; }
.kb-msg-text { font-size: 12px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.kb-msg-text .mention { color: var(--accent-cyan); font-weight: 600; }
.kb-message.kb-system { background: var(--accent-cyan-soft); padding: 6px 8px; margin: 4px 0; border: none; }
.kb-result { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--accent-cyan); background: var(--accent-cyan-soft); font-size: 11px; font-weight: 600; }

.kb-subthread { margin: 6px 0 6px 34px; border: 1px dashed var(--border); padding: 6px 10px; background: #fafbfc; cursor: pointer; }
.kb-subthread:hover { border-color: var(--accent-cyan); }
.kb-subthread-title { font-size: 11px; font-weight: 600; color: var(--ink); }
.kb-subthread-meta { font-size: 10px; color: var(--muted); }

.kb-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; background: var(--accent-cyan); color: #fff; font-size: 9px; font-weight: 700; }

.questmarker {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--primary-dark); color: #fff;
  padding: 8px 14px; display: flex; align-items: center; gap: 10px;
}
.questmarker-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--accent-cyan); flex-shrink: 0; }
.questmarker-title { font-size: 12px; font-weight: 600; flex: 1; }
.questmarker-btn { padding: 5px 12px; background: var(--accent-cyan); color: #fff; border: none; font-size: 11px; font-weight: 700; cursor: pointer; }
.questmarker-btn:hover { background: var(--accent-cyan-hover); }

/* Legacy Comment thread */
.comment-thread { border: 1px solid var(--border); background: #fff; }
.comment-main {
  padding: 10px 14px;
  display: flex; gap: 10px;
}
.comment-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--primary-dark); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.comment-avatar.bot { background: var(--accent-cyan); }
.comment-content { flex: 1; min-width: 0; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--ink); }
.comment-time { font-size: 10px; color: var(--muted-2); margin-left: 6px; }
.comment-text { font-size: 13px; color: var(--ink); line-height: 1.5; margin-top: 3px; }
.comment-text .mention { color: var(--accent-cyan); font-weight: 600; }
.comment-replies {
  border-top: 1px solid var(--border);
  padding-left: 38px;
  background: #fafbfc;
}
.comment-reply { padding: 8px 14px 8px 0; border-top: 1px solid var(--border); }
.comment-reply:first-child { border-top: none; }
.comment-reply-toggle {
  padding: 6px 14px 6px 0;
  font-size: 11px; color: var(--accent-cyan); font-weight: 600;
  cursor: pointer; border: none; background: none;
}
.comment-reply-toggle:hover { text-decoration: underline; }

/* ============================================================ SEARCH VIEW */
.search-view { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.search-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex; flex-direction: column; gap: 10px;
  flex-shrink: 0;
}
.search-topbar-row {
  /* Etappe 1 (Etappe 2 reisst die ganze Zeile heraus): View-eigene Suchleiste
     versteckt, weil sie seit der globalen Topbar-Suche doppelt erscheint. Das
     HTML/JS bleibt funktional damit Listener und els.input weiter greifen. */
  display: none;
}
.search-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--accent-cyan);
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-cyan-mid);
}
.search-input-wrap svg { width: 22px; height: 22px; color: var(--accent-cyan); flex-shrink: 0; }
.search-input-wrap input {
  flex: 1; border: none; outline: none;
  font-size: 17px; background: transparent; color: var(--ink);
}
.search-input-wrap input::placeholder { color: var(--muted-2); }
.search-tag {
  background: var(--accent-cyan-soft); color: var(--accent-cyan);
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  letter-spacing: 0.3px; white-space: nowrap;
}
.search-filters-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.search-filter {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; color: var(--ink);
}
.search-filter:focus { border-color: var(--accent-cyan); }
.search-results-foot {
  padding: 18px 16px; text-align: center;
  font-size: 12px; color: var(--muted);
  border-top: 1px dashed var(--border);
}
/* Beide Toggles als eigene, linksbündige Zeile (volle Breite unter den Filtern). */
.search-toggles {
  flex-basis: 100%;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 16px;
}
.search-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); cursor: pointer;
  white-space: nowrap;
}
.search-toggle input { accent-color: var(--accent-cyan); }

/* Full-width Tabelle + Detail-Overlay.
   .search-split ist nur noch der Positionierungs-Kontext: die Tabelle fuellt die
   volle Breite, das Detail-Panel liegt als absolut positioniertes Slide-in
   darueber (rechts). */
.search-split {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
.search-results {
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
}
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* ===== Treffer-Tabelle ===== */
.search-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--surface);
}
.search-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; letter-spacing: 0.3px; text-transform: uppercase;
  padding: 9px 12px;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}
.search-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted); vertical-align: top;
}
.search-table tr.search-result { cursor: pointer; transition: background 0.1s; }
.search-table tr.search-result:hover td { background: var(--accent-cyan-soft); }
.search-table tr.search-result.active td { background: var(--accent-cyan-mid); }
/* Rated-Akzent als Cyan-Kante an der ersten Zelle (statt der alten Karten-::before). */
.search-table tr.rated-ideal td.col-title { box-shadow: inset 3px 0 0 var(--accent-cyan); }
.search-table tr.rated-interessant td.col-title { box-shadow: inset 3px 0 0 var(--cyan-soft-flat); }

.search-table .col-title { width: 20%; }
.search-table .col-lot { width: 13%; }
.search-table .col-buyer { width: 14%; }
.search-table .col-ort { width: 9%; }
.search-table .col-vergabe { width: 9%; white-space: nowrap; }
.search-table .col-cpv { width: 14%; }
.search-table .col-deadline { width: 14%; white-space: nowrap; }
.search-table .col-status { width: 7%; white-space: nowrap; }
.search-table .cpv-text { color: var(--muted-2); }

/* Ampel-Frist (Basisfarben, kein Slider) */
.dl-traffic { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink); }
.dl-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Status-Chip */
.status-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; letter-spacing: 0.2px; white-space: nowrap;
  border: 1px solid var(--border);
}
.status-badge.status-unread { color: var(--muted-2); background: var(--bg); }
.status-badge.status-board { color: var(--accent-cyan-hover); background: var(--accent-cyan-soft); border-color: var(--accent-cyan-mid); }
.status-badge.status-archive { color: var(--muted); background: var(--surface); }

.search-table .search-result-title {
  font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-table .search-result-subtitle {
  font-size: 11px; color: var(--muted-2); margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.search-table tr.search-table-foot td {
  padding: 18px 16px; text-align: center;
  font-size: 12px; color: var(--muted);
  border-bottom: none; border-top: 1px dashed var(--border);
}
.search-result-empty {
  padding: 40px 20px; text-align: center;
  color: var(--muted); font-size: 13px;
}

/* ===== Detail-Overlay (Slide-in von rechts) ===== */
.search-detail-backdrop {
  position: absolute; inset: 0; z-index: 15;
  background: rgba(15, 30, 40, 0);
  pointer-events: none;
  transition: background 0.28s ease;
}
.search-view.detail-open .search-detail-backdrop {
  background: rgba(15, 30, 40, 0.18);
  pointer-events: auto;
}
.search-detail-col {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 20;
  width: min(560px, 46%);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 2px solid var(--border);
  box-shadow: -8px 0 24px -10px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.search-view.detail-open .search-detail-col { transform: translateX(0); }

/* Rating badge (compact) */
.rating-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  letter-spacing: 0.2px;
  position: relative;
}
.rating-badge.irrelevant  { background: #f3f4f5; color: #9aa0a9; }
.rating-badge.ungeeignet  { background: #fdeaea; color: #d63031; }
.rating-badge.potentiell  { background: #fef8ec; color: #c89b3c; }
.rating-badge.interessant { background: rgba(0,153,122,0.08); color: #00997a; }
.rating-badge.ideal       { background: rgba(0,187,221,0.08); color: #00bbdd; }
.rating-badge.user-rated  { font-weight: 800; box-shadow: inset 0 0 0 1px currentColor; }

.rating-tooltip {
  display: none;
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark); color: #fff;
  padding: 8px 12px;
  font-size: 11px; font-weight: 400;
  white-space: nowrap;
  z-index: 90;
  min-width: 180px;
}
.rating-badge:hover .rating-tooltip { display: block; }
.rating-tooltip-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.rating-tooltip-line .agent-name { opacity: 0.7; }

/* Process badge */
.process-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 6px; color: #fff;
}
.process-badge.analyse   { background: var(--accent-cyan); }
.process-badge.bewerbung { background: var(--primary-dark); }

/* Detail panel */
/* Karte = Detail + Rating-Bar gemeinsam (für Fly-Animation). */
.search-detail-card {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  transform-origin: center center;
  --fly-dx: 0px;
  --fly-dy: 0px;
}
.search-detail-card.is-flying {
  animation: vfx-card-fly 760ms cubic-bezier(0.55, 0, 0.85, 1) forwards;
  pointer-events: none;
}
.search-detail-card.is-entering {
  animation: vfx-card-enter 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes vfx-card-fly {
  0%   { transform: translate(0, 0) scale(1);    opacity: 1; }
  22%  { transform: translate(0, 0) scale(0.18); opacity: 1; }
  85%  { transform: translate(var(--fly-dx), var(--fly-dy)) scale(0.18); opacity: 1; }
  100% { transform: translate(var(--fly-dx), var(--fly-dy)) scale(0);    opacity: 1; }
}
@keyframes vfx-card-enter {
  0%   { transform: translateY(36px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

.search-detail {
  overflow-y: auto;
  padding: 0;
  background: var(--surface);
}
.search-detail::-webkit-scrollbar { width: 6px; }
.search-detail::-webkit-scrollbar-thumb { background: var(--border-strong); }
.search-detail-inner { padding: 24px 28px 80px; }
.search-detail-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 13px;
}

/* ===== Such-Detail-Pane (kompakte rechte Spalte) ===== */
.sdp {
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 24px 28px;
}
.sdp-empty { padding: 30px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.sdp-kurz {
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
  white-space: pre-wrap;
}
.sdp-source {
  align-self: flex-start;
  font-size: 13px; font-weight: 700; color: var(--accent-cyan);
  text-decoration: none;
}
.sdp-source:hover { text-decoration: underline; }

.sdp-rating { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.sdp-rating-label {
  font-size: 12px; color: var(--muted);
  padding-top: 12px;
}
.sdp-rating-label strong { color: var(--ink); font-weight: 700; }
.sdp-stars {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}
.sdp-star {
  height: 32px; padding: 0 6px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.sdp-star:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.sdp-star.is-sel {
  background: var(--accent-cyan); color: #fff; border-color: var(--accent-cyan);
}

.sdp-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.sdp-act {
  height: 40px; padding: 0 14px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.sdp-act:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.sdp-act-primary {
  background: var(--accent-cyan); color: #fff; border-color: var(--accent-cyan);
}
.sdp-act-primary:hover {
  background: var(--accent-cyan-hover, #0096b8); border-color: var(--accent-cyan-hover, #0096b8);
  color: #fff;
}

.search-detail-header { margin-bottom: 20px; }
.search-detail-title { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.25; margin-bottom: 4px; }
.search-detail-authority { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.search-detail-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.search-detail-meta strong { color: var(--ink); font-weight: 600; }

/* Agent analysis box */
.agent-analysis {
  background: #fafbfc;
  border: 1px solid var(--border);
  padding: 18px 22px;
  margin: 20px 0;
}
.agent-analysis-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.agent-analysis-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted);
}
.agent-analysis-items { display: flex; flex-direction: column; gap: 8px; }
.agent-analysis-item {
  display: grid; grid-template-columns: auto 1fr;
  gap: 10px; align-items: start;
  font-size: 13px; line-height: 1.5;
}
.agent-analysis-item .note { color: var(--ink); }
.agent-analysis-item .agent-name { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Fixed rating bar — floats over detail column only */
.rating-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-top: 2px solid var(--accent-cyan-mid);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
}
.rating-bar.hidden { display: none; }
.rating-bar-label {
  font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px;
  margin-right: 8px;
}
.rating-btn {
  height: 40px;
  padding: 0 20px;
  border: 2px solid transparent;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.rating-btn .rating-key {
  display: inline-block;
  width: 20px; height: 20px;
  border: 1px solid rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.5);
  font-size: 10px; font-weight: 700;
  text-align: center; line-height: 20px;
  margin-left: 4px;
  opacity: 0.6;
}
.rating-btn.irrelevant  { background: #f3f4f5; color: #9aa0a9; border-color: #e2e4e7; }
.rating-btn.ungeeignet  { background: #fdeaea; color: #d63031; border-color: #f5b7b7; }
.rating-btn.potentiell  { background: #fef8ec; color: #c89b3c; border-color: #e8d5a0; }
.rating-btn.interessant { background: rgba(0,153,122,0.08); color: #00997a; border-color: rgba(0,153,122,0.3); }
.rating-btn.ideal       { background: rgba(0,187,221,0.08); color: #00bbdd; border-color: rgba(0,187,221,0.3); }
.rating-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px -2px rgba(0,0,0,0.15); }
.rating-btn.active-rating { box-shadow: inset 0 0 0 2px currentColor; transform: scale(1.05); }

.rating-btn.irrelevant:hover  { background: #e8e9eb; }
.rating-btn.ungeeignet:hover  { background: #f8d4d4; }
.rating-btn.potentiell:hover  { background: #fdf0d5; }
.rating-btn.interessant:hover { background: rgba(0,153,122,0.15); }
.rating-btn.ideal:hover       { background: rgba(0,187,221,0.15); }

/* Bid / No-Bid decision buttons (same slot as the rating buttons) */
.decision-btn {
  height: 40px; padding: 0 24px;
  border: 2px solid transparent;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all 0.15s;
}
.decision-btn.decision-bid   { background: var(--accent-cyan); color: #fff; }
.decision-btn.decision-bid:hover   { background: var(--accent-cyan-hover); transform: translateY(-2px); }
.decision-btn.decision-nobid { background: #fff; color: #d63031; border-color: #f5b7b7; }
.decision-btn.decision-nobid:hover { background: #fdeaea; }

/* Rating progress indicator */
.rating-progress {
  position: absolute; right: 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
}
.rating-progress strong { color: var(--accent-cyan); }

/* Kandidaten column badge */
.kandidaten-rating {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; margin-top: 6px;
}

/* Search view overrides main area when active */
.main.has-rating-bar { bottom: calc(var(--assistant-h) + 60px); }

/* ============================================================ EIGNUNG — Werkzeuge · Skala · Aktionsleiste (Markenpalette)
   Disziplinierte Palette: nur Navy · Grau · Cyan. Eignung als ordinale Skala,
   nicht als Ampel. Genau ein Cyan-Blickfang pro Zone. */

/* -- Detail-Header: ruhige Werkzeug-Icons (Workspace · Teilen · Portal) -- */
.detail-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.detail-tool {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  cursor: pointer; text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}
.detail-tool:hover { border-color: var(--accent-cyan); color: var(--accent-cyan-hover); text-decoration: none; }
.detail-tool svg { width: 14px; height: 14px; }

/* Prominenter "Zur Originalausschreibung"-Block (Titel + großer Button, wie v1) */
.detail-source-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 16px 0 18px; padding: 14px 18px;
  background: var(--cyan-soft-flat); border: 2px solid var(--accent-cyan);
  text-decoration: none; transition: background 0.15s;
}
.detail-source-cta:hover { background: var(--cyan-soft, #d6f3fa); }
.detail-source-cta-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-source-cta-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.detail-source-cta-sub { font-size: 12.5px; color: var(--muted); }
.detail-source-cta-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 22px; background: var(--accent-cyan); color: #fff;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.detail-source-cta-btn svg { width: 16px; height: 16px; }
.detail-source-cta:hover .detail-source-cta-btn { background: var(--accent-cyan-hover); }
@media (max-width: 560px) {
  .detail-source-cta { flex-direction: column; align-items: stretch; }
  .detail-source-cta-btn { justify-content: center; }
}

/* -- Vergabeunterlagen-Liste innerhalb der Detail-Ansicht -- */
.detail-documents { margin-top: 28px; }
.detail-documents .detail-section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.4px;
}
.detail-documents-list { display: flex; flex-direction: column; gap: 6px; }
.detail-documents-hint { font-size: 13px; color: var(--muted); margin: 0; }
.detail-document-item { display: flex; flex-direction: column; }
.detail-document {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border); color: var(--ink);
  text-align: left; cursor: pointer; font: inherit; font-size: 13.5px;
  transition: background 0.15s, border-color 0.15s;
}
.detail-document:hover { background: var(--cyan-soft, #d6f3fa); border-color: var(--accent-cyan); }
.detail-document[aria-expanded="true"] { border-color: var(--accent-cyan); border-bottom-color: transparent; background: var(--cyan-soft, #d6f3fa); }
.detail-document-icon { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.detail-document-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.detail-document-meta { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.detail-document-caret { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform 0.18s; }
.detail-document[aria-expanded="true"] .detail-document-caret { transform: rotate(180deg); }
.detail-document-view { border: 1px solid var(--accent-cyan); border-top: none; padding: 14px 16px; background: var(--surface); }
.detail-document-view:empty { display: none; }

/* -- Eignungs-Skala: segmentiert, diverging dunkel(Navy)←grau→cyan -- */
.eig-scale { display: inline-flex; border: 1px solid var(--border); background: #fff; }
.eig-seg {
  height: 34px; padding: 0 14px;
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: #fff; border: none; border-right: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.eig-seg:last-child { border-right: none; }
.eig-seg:hover { background: var(--bg); }
.eig-seg.is-sel { font-weight: 700; }
/* Likert 1–4: diverging Navy(1)←grau(2)→cyan-soft(3)→cyan(4). 1,2 = Archiv · 3,4 = Board. */
.eig-seg.s-1, .eig-seg.s-2, .eig-seg.s-3, .eig-seg.s-4, .eig-seg.s-5 { min-width: 44px; justify-content: center; padding: 0; font-family: var(--font-mono, ui-monospace, monospace); }
.eig-seg.is-sel.s-1 { background: var(--tiefsee, #102a3d); color: #fff; }                                   /* Irrelevant */
.eig-seg.is-sel.s-2 { background: #d6dee4; color: var(--ink); box-shadow: inset 0 -3px 0 var(--muted-3); }   /* Unpassend */
.eig-seg.is-sel.s-3 { background: var(--cyan-soft-flat); color: var(--accent-cyan-hover); }                  /* Potentiell */
.eig-seg.is-sel.s-4 { background: rgba(0,187,221,0.5); color: #06303a; }                                     /* Passend */
.eig-seg.is-sel.s-5 { background: var(--accent-cyan); color: #fff; }                                         /* Ideal */
/* Agent-Vorschlag (noch nicht selbst bewertet) — Cyan-Ring, ohne Füllung */
.eig-seg.is-suggested { box-shadow: inset 0 0 0 2px var(--accent-cyan); color: var(--accent-cyan-hover); font-weight: 700; }

/* -- Zwei-Zonen-Aktionsleiste (überschreibt die zentrierte .rating-bar) -- */
.rating-bar.rating-bar--detail {
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--cyan-soft-flat);
  border-top: 3px solid var(--accent-cyan);
}
/* Bewertung als klarer "Nächster Schritt" — Eyebrow + Frage + große 1–4-Buttons */
.da-rate-prompt { display: flex; flex-direction: column; gap: 1px; }
.da-step-eyebrow { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--accent-cyan-hover); text-transform: uppercase; letter-spacing: 0.16em; }
.da-zone-q { font-size: 14px; font-weight: 700; color: var(--ink); }
.da-zone-hint { font-size: 12.5px; font-weight: 400; color: var(--muted); line-height: 1.4; }
.da-rate-prompt--lg .da-zone-hint { font-size: 13px; }
.eig-scale--lg { border-width: 2px; box-shadow: 0 2px 10px rgba(16,42,61,0.10); }
.eig-scale--lg .eig-seg { height: 46px; }
.eig-scale--lg .eig-seg.s-1, .eig-scale--lg .eig-seg.s-2, .eig-scale--lg .eig-seg.s-3, .eig-scale--lg .eig-seg.s-4, .eig-scale--lg .eig-seg.s-5 { min-width: 60px; font-size: 17px; }

/* 5-stufige Entscheidungs-Skala (Suche): Ins Archiv ←  Skala  → Ins Board */
.da-zone-decide5 { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
.da-rate-prompt--lg { align-items: center; text-align: center; gap: 3px; }
.da-step-eyebrow--lg { font-size: 14px; letter-spacing: 0.18em; }
.da-rate-prompt--lg .da-zone-q { font-size: 15px; }
/* Eine Reihe: Ins Archiv (links) — Skala (mitte) — Ins Board (rechts), kein Umbruch. */
.da-decide5 { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: nowrap; }
.da-decide5-side {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  font-size: 13px; font-weight: 700; white-space: nowrap; user-select: none;
}
.da-decide5-side svg { width: 18px; height: 18px; }
.da-decide5-archive { color: var(--muted); }
.da-decide5-board { color: var(--accent-cyan-hover); }
/* Gleich große Boxen + Wort-Labels (normale Schrift statt Mono); Skala nimmt die
   volle Breite und gibt den Segmenten ordentlich Platz. */
.eig-scale--5 { flex: 1 1 auto; min-width: 0; }
.eig-scale--5 .eig-seg { flex: 1 1 0; height: 56px; }
.eig-scale--5 .eig-seg.s-1, .eig-scale--5 .eig-seg.s-2, .eig-scale--5 .eig-seg.s-3,
.eig-scale--5 .eig-seg.s-4, .eig-scale--5 .eig-seg.s-5 {
  min-width: 0; padding: 0 18px; font-family: inherit; font-size: 16px; font-weight: 600;
}
/* Cutoff zwischen Unpassend (2) und Potentiell (3): sichtbarer Spalt + Trennlinie.
   Skala-Hintergrund transparent → im Spalt scheint der (cyan-soft) Leisten-Hintergrund
   durch, sonst wäre die weiße Lücke auf weißem Grund unsichtbar. Außenrahmen weg, dafür
   bekommt jedes Segment Ober-/Unterkante, damit der Spalt die zwei Gruppen wirklich trennt
   (keine durchlaufende Rahmenlinie über die Lücke). Normalen Trenner rechts von „Unpassend"
   entfernen, damit im Spalt nur die eine Cutoff-Linie steht. */
.eig-scale--5 { background: transparent; border: none; }
.eig-scale--5 .eig-seg { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.eig-scale--5 .eig-seg.s-1 { border-left: 1px solid var(--border); }
.eig-scale--5 .eig-seg.s-5 { border-right: 1px solid var(--border); }
.eig-scale--5 .eig-seg.s-2 { border-right: none; }
.eig-scale--5 .eig-seg--cut { margin-left: 16px; position: relative; }
/* Cutoff-Linie freistehend genau in der Mitte des Spalts (-8px = halbe 16px-Lücke,
   minus halbe Linienbreite), oben/unten etwas über die Segment-Kanten hinaus. */
.eig-scale--5 .eig-seg--cut::before {
  content: ''; position: absolute; left: -9px; top: -4px; bottom: -4px; width: 2px;
  background: var(--tiefsee, #102a3d);
}
@media (max-width: 700px) {
  .da-decide5 { flex-direction: column; gap: 8px; }
  .da-decide5-side { justify-content: center; }
  .eig-scale--5 { flex: 1 1 auto; width: 100%; }
}
.rating-bar--detail .da-btn { height: 46px; padding: 0 24px; font-size: 14px; }
.da-zone { display: flex; align-items: center; gap: 12px; }
.da-zone-label {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.16em;
}
.da-zone-decide { gap: 8px; }
.da-btn {
  height: 34px; padding: 0 18px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; cursor: pointer; border: none;
}
.da-btn-primary { background: var(--accent-cyan); color: #fff; }
.da-btn-primary:hover { background: var(--accent-cyan-hover); }
.da-btn-ghost { background: none; color: var(--muted); }
.da-btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.da-btn svg { width: 14px; height: 14px; }

/* Board/Archiv-Entscheidung (ersetzt die 1–4-Skala) */
.da-choice { display: inline-flex; gap: 8px; }
.da-choice-btn {
  height: 46px; padding: 0 22px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: 2px solid var(--border); background: #fff; color: var(--ink);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.da-choice-btn svg { width: 16px; height: 16px; }
.da-choice-board { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #fff; }
.da-choice-board:hover { background: var(--accent-cyan-hover); border-color: var(--accent-cyan-hover); }
.da-choice-archive { background: #fff; color: var(--muted); border-color: var(--border); }
.da-choice-archive:hover { background: var(--bg-2); color: var(--ink); border-color: var(--muted-3); }
.da-choice-btn.is-suggested { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.da-choice-btn.is-sel { box-shadow: inset 0 0 0 3px rgba(16,42,61,0.16); }
@media (max-width: 700px) {
  .da-choice { width: 100%; }
  .da-choice-btn { flex: 1 1 0; justify-content: center; padding: 0 12px; }
}

@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .reader-wrap { grid-template-columns: 1fr; }
  .chat-panel { width: calc(100vw - 24px); max-width: none; left: 12px; transform: none; }
  .rating-bar { padding: 8px 12px; gap: 4px; }
  .rating-btn { padding: 0 12px; font-size: 11px; height: 36px; }
}

/* ============================================================ RESPONSIVE (Tablet/Mobile)
   Konzept: Board 3-stufig — Desktop (>1024) zeigt alle 4 Spalten geteilt; Tablet
   (≤1024) zeigt 2 Spalten + Wischen; Phone (≤768) eine Spalte + Wischen. So bleiben
   die Spalten breit genug, dass die Fristen-Pill in den Kärtchen nie abgeschnitten
   wird. Mobile ≤768 zusätzlich: Icon-Sidebar → Bottom-Nav, Topbar verschlankt,
   Mehrspalter einspaltig, Dashboard-Kacheln 2×2, Eignungs-Skala 4×25 %. */

/* Tablet/Phone: Spalten fester Breite (gedeckelt), so viele nebeneinander wie
   passen, Rest horizontal wischbar. Dadurch zeigt ein breiterer Screen automatisch
   MEHR Spalten (402px≈1, 712px≈2, 1024px≈3) statt einer einzigen riesigen Spalte. */
@media (max-width: 1024px) {
  /* .board MUSS auf max-content wachsen, sonst „sieht" der scrollende Container
     (.board-split-columns) keinen Überlauf → kein Scrollbalken, Spalten werden
     abgeschnitten statt wischbar. */
  /* -webkit-overflow-scrolling gehört auf den SCROLL-Container (.board-split-columns),
     nicht auf den Inhalt. Kein scroll-snap mehr (saß am falschen Element, war nie aktiv).
     WICHTIG: .board bekommt eine EXPLIZITE Breite statt `min-width: max-content`.
     max-content auf Flex-Containern berechnet Firefox anders als Chromium (FF kann
     den UNumbrochenen Inhalt der Spalten einrechnen) → in Firefox entstand dadurch
     Phantom-Leerraum hinter „Abgaben". Die explizite Breite = 4 Spalten (vgl. COLUMNS
     in board.js) × Spaltenbreite + 3 Lücken·12px + 2 Innenabstände·12px (= 60px) ist
     in jeder Engine identisch. */
  .board-split-columns { -webkit-overflow-scrolling: touch; }
  .board-split-columns .board {
    width: calc(4 * min(86vw, 340px) + 60px);
    min-width: 0;
  }
  .board-split-columns .board .column {
    flex: 0 0 min(86vw, 340px); min-width: 0; height: 100%;
  }
  /* Legacy-Detail-Panel (Karten öffnen den Workspace, nicht dieses Panel) im
     geschlossenen Zustand komplett ausblenden — sonst ragen sein 2px-Rand + die
     Header-Buttons rechts über den Bildschirmrand („leichter Überstand"). */
  .board-split-detail:not(.open) { display: none; }

  /* Workspace: Das 3-Spalten-Grid (Nav | Detail | Diskussion) ist auf Tablet/Phone
     zu eng (Buttons/Inputs liefen über). → eine durchgehende Scroll-Spalte mit dem
     Detail zuerst, dann Roter Faden, dann Diskussion; Rating-Bar statisch (war
     position:sticky → überlappte den Titel). Gilt für Tablet UND Phone. */
  .workspace-body { display: flex; flex-direction: column; overflow-y: auto; }
  .workspace-main { order: 1; overflow: visible; border-right: none; }
  .workspace-nav { order: 2; overflow: visible; border-right: none; border-top: 1px solid var(--border); }
  .workspace-comments { order: 3; overflow: visible; border-top: 1px solid var(--border); }
  .workspace-main-inner { padding: 18px 16px 28px; }
  .workspace .rating-bar { position: static; }
  .workspace-comments-input { padding: 10px 12px; }
  .workspace-comments-input input, .workspace-comments-input button { max-width: 100%; }
}

@media (max-width: 768px) {
  /* Topbar verschlanken */
  .topbar { padding: 0 10px; }
  .topbar-brand { min-width: 0; }
  .topbar-brand-sub { display: none; }
  .topbar-crumbs { display: none; }
  .topbar-company-info { display: none; }
  .topbar-company { padding: 6px; gap: 0; }
  /* Ohne Brotkrumen-Spacer die Actions nach rechts schieben … */
  .topbar-actions { margin-left: auto; }
  /* … und das Dropdown fix am rechten Rand verankern, damit es nie abgeschnitten wird */
  .company-menu { position: fixed; top: var(--chrome-h); right: 8px; left: auto; width: min(280px, calc(100vw - 16px)); }

  /* Icon-Sidebar → Bottom-Navigation */
  .sidebar {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 54px;
    flex-direction: row; justify-content: space-around; align-items: center;
    padding: 0; gap: 0;
    border-right: none; border-top: 1px solid var(--border);
    z-index: 60;
  }
  .sidebar-spacer { display: none; }
  .sidebar-btn .tip { display: none; }

  /* Hauptbereich: kein Seiten-Offset, Platz für Bottom-Nav */
  .main { left: 0; right: 0; bottom: 54px; }

  /* Board-Spaltenbreite kommt aus dem ≤1024-Block (min(86vw,340px)) — hier nur
     noch das geöffnete Legacy-Detail-Panel auf volle Breite begrenzen. */
  .board-split-detail.open { width: 100%; min-width: 0; }

  /* Mehrspaltige Layouts → einspaltig (vertikal scrollbar) */
  .form-grid { grid-template-columns: 1fr; }
  .reader-wrap { grid-template-columns: 1fr; overflow-y: auto; }

  /* Workspace-Overlay NUR auf Phone: kein Sidebar-Versatz (sonst 60px Rand links)
     und über der Bottom-Nav enden. Das Spalten-Stacking liegt im ≤1024-Block
     (gilt für Tablet mit). */
  .workspace { left: 0; bottom: 54px; }
  .workspace-topbar { height: auto; min-height: 42px; padding: 6px 12px; }

  /* Dashboard-Kacheln: 2×2 statt 4 nebeneinander (sonst fällt die 4. raus) */
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* Sehr schmale Phones (≤440px): die 2×2-Kacheln passen nicht ganz nebeneinander
     (Label-Wortbreite drückt sie ~10–34px über den Rand) → einspaltig stapeln,
     dann sind alle 4 vollständig sichtbar, nichts abgeschnitten. */
  @media (max-width: 440px) { .dash-stats { grid-template-columns: 1fr; } }

  /* Modals nahezu Vollbild */
  .modal { max-width: 94vw; max-height: 90vh; }
  .modal-backdrop { padding: 8px; }

  /* Eignungs-Skala: NICHT scrollen, sondern verkleinern — Frage über der Skala,
     die 4 Stufen teilen sich 100 % Breite (je 25 %). So sind immer alle 4 sichtbar
     (User-Feedback: vorher nur 1–3 sichtbar). */
  .rating-bar.rating-bar--detail { flex-direction: column; align-items: stretch; gap: 10px; padding: 11px 12px; }
  .rating-bar.rating-bar--detail .da-zone { min-width: 0; }
  .da-zone-rate { flex-direction: column; align-items: stretch; gap: 8px; }
  .eig-scale { display: flex; width: 100%; max-width: 100%; }
  .eig-seg,
  .eig-seg.s-1, .eig-seg.s-2, .eig-seg.s-3, .eig-seg.s-4, .eig-seg.s-5 { flex: 1 1 0; min-width: 0; padding: 0; }
  .da-zone-decide { flex-wrap: wrap; }

  /* Auf schmalen Screens nur die Kernspalten zeigen. */
  .search-table .col-lot,
  .search-table .col-ort,
  .search-table .col-vergabe,
  .search-table .col-cpv { display: none; }

  /* (Onboarding-Bubble/-Panel werden im onboarding-client.js per Media-Query
     positioniert — dort gewinnt die Regel gegen die injizierte Basis.) */
}

/* Zurück-Button der Suche: nur auf Mobile sichtbar (per Media-Query oben). */
.search-back {
  display: block;
  width: 100%; text-align: left;
  padding: 11px 16px;
  background: var(--bg); border: none; border-bottom: 1px solid var(--border);
  color: var(--accent-cyan-hover); font-weight: 600; font-size: 13px; cursor: pointer;
  flex-shrink: 0;
}

/* ==================== Matching-Agenten — Karten-Layout ==================== */
.agent-explain { display: flex; gap: 12px; padding: 14px 16px; background: var(--cyan-soft-flat, #d6f3fa); border: 1px solid var(--accent-cyan); margin-bottom: 18px; }
.agent-explain svg { width: 22px; height: 22px; color: var(--accent-cyan-hover); flex-shrink: 0; margin-top: 1px; }
.agent-explain p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.agent-explain b { color: var(--ink); }

.agent-card { border: 1px solid var(--border); background: #fff; margin-bottom: 12px; }
.agent-card.running { border-color: var(--accent-cyan); }
.agent-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px 16px 0; }
.agent-top-main { min-width: 0; flex: 1; }
.agent-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.agent-profile { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.agent-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; white-space: nowrap; flex-shrink: 0; }
.agent-pill .dot { width: 6px; height: 6px; }
.agent-pill.aktiv { background: var(--cyan-soft-flat, #d6f3fa); color: var(--accent-cyan-hover); }
.agent-pill.aktiv .dot { background: var(--accent-cyan); }
.agent-pill.pausiert { background: #eef1f3; color: var(--muted); }
.agent-pill.pausiert .dot { background: var(--muted-2); }
.agent-pill.laeuft { background: var(--accent-cyan); color: #fff; }
.agent-pill.laeuft .dot { background: #fff; animation: agpulse 1.3s infinite; }
@keyframes agpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.agent-schedule { display: flex; align-items: center; gap: 8px; margin: 12px 16px 0; padding: 9px 12px; background: var(--bg, #f6f8fa); border-left: 3px solid var(--accent-cyan); font-size: 13px; color: var(--ink); }
.agent-schedule.off { border-left-color: var(--muted-2); color: var(--muted); }
.agent-schedule svg { width: 16px; height: 16px; color: var(--accent-cyan-hover); flex-shrink: 0; }
.agent-schedule.off svg { color: var(--muted-2); }
.agent-schedule b { color: var(--ink); }

.agent-run { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 16px 0; padding: 9px 12px; background: rgba(0,187,221,0.08); border: 1px solid var(--accent-cyan); font-size: 12.5px; color: var(--accent-cyan-hover); font-weight: 600; }

.agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 16px; margin-top: 12px; border-top: 1px solid var(--border); }
.ag-toggle { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ag-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.ag-switch input { opacity: 0; width: 0; height: 0; }
.ag-slider { position: absolute; inset: 0; background: #cbd5db; transition: 0.18s; cursor: pointer; }
.ag-slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; transition: 0.18s; }
.ag-switch input:checked + .ag-slider { background: var(--accent-cyan); }
.ag-switch input:checked + .ag-slider::before { transform: translateX(18px); }

.agent-actions { display: flex; align-items: center; gap: 8px; }
.ag-btn { height: 34px; padding: 0 16px; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; }
.ag-btn svg { width: 15px; height: 15px; }
.ag-btn-run { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #fff; }
.ag-btn-run:hover { background: var(--accent-cyan-hover); border-color: var(--accent-cyan-hover); }
.ag-btn-run:disabled { background: #eef1f3; border-color: var(--border); color: var(--muted-2); cursor: not-allowed; }
.ag-btn-stop { background: #fff; color: #c0392b; border-color: #e6b9b3; }
.ag-btn-ghost { background: none; border: none; color: var(--muted); padding: 0 8px; height: 30px; font-family: inherit; font-size: 12px; cursor: pointer; }
.ag-btn-ghost:hover { color: var(--ink); }

@media (max-width: 640px) {
  .agent-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .agent-actions { justify-content: space-between; }
  .ag-btn-run { flex: 1; justify-content: center; }
}

/* ============================================================ DOC-VIEWER (Sprungmarken) */
/* Inline-Anker in Markdown-Texten (Agent-Antworten zitieren so ihre Quellen). */
.doc-anchor {
  display: inline-flex; align-items: baseline; gap: 4px;
  color: var(--accent-cyan); text-decoration: none;
  border-bottom: 1px dotted var(--accent-cyan);
  cursor: pointer; font-weight: 600;
}
.doc-anchor::after {
  content: "↗"; font-size: 0.85em; color: var(--muted-2);
}
.doc-anchor:hover { background: var(--cyan-soft, #d6f3fa); border-bottom-style: solid; }
.doc-anchor:hover::after { color: var(--accent-cyan); }

/* Modal-Overlay + Container — fixed, ueber allem. */
.doc-modal-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 25, 35, 0.62);
  display: flex; align-items: stretch; justify-content: center;
  padding: 24px;
}
.doc-modal {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e4e7);
  width: min(1100px, 100%);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}
.doc-modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.doc-modal-title { flex: 1; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.doc-modal-name { font-weight: 700; color: var(--ink); }
.doc-modal-sub  { font-size: 12.5px; color: var(--muted); }
.doc-modal-open {
  text-decoration: none; color: var(--muted); padding: 4px 10px;
  border: 1px solid var(--border); background: #fff; font-size: 13px;
}
.doc-modal-open:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.doc-modal-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted-2);
  width: 32px; height: 32px;
}
.doc-modal-close:hover { color: var(--ink); }
.doc-modal-body { flex: 1; min-height: 0; display: flex; }
.doc-modal-frame { flex: 1; width: 100%; border: 0; background: #f1f3f5; }
