/* =========================================================================
 * output.css — DTL Portal stylesheet (DTL-1.6).
 *
 * THIS IS A HAND-CURATED TAILWIND SUBSET.
 *
 * Rationale: the deployment environment (IIS + Windows + waitress) has no
 * Node toolchain, so we cannot run `npx tailwindcss` at build/deploy time.
 * Rather than depend on a CDN (CSP forbids remote stylesheets) or commit
 * a multi-megabyte `tailwindcss` output, we ship a minimal hand-written
 * subset that covers the exact classes used by base.html + the Phase 3/4
 * page templates (login, select_bu, welcome, password_help, error).
 *
 * Bring-up plan: once we have a Node-on-Windows pipeline (TBD), regenerate
 * this file with the Tailwind CLI against the templates folder. Until then,
 * any new utility class used in a template must be added below by hand.
 *
 * Custom utilities provided (DTL-Grün primary):
 *   .text-dtl-green     — #2E7D32 foreground
 *   .bg-dtl-green       — #2E7D32 background
 *   .border-dtl-green   — #2E7D32 border
 *   .ring-dtl-green     — focus-ring colour
 *   .btn-primary        — DTL-Grün CTA button
 *   .btn-secondary      — neutral grey button (white fill + grey border)
 *   .btn-tertiary       — ghost button (no border, transparent fill,
 *                         recedes against primary/secondary in action-rows)
 *   .error-banner       — red-bordered error notice
 *   .info-banner        — blue-bordered info notice
 *
 * Change log:
 *   2026-05-11  Initial hand-curated subset (DTL-1.6).
 *   2026-05-11  Refinement — mobile-responsive utilities added: w-full/sm:max-w-md
 *               for the login card to reach viewport edges below 640px,
 *               sm:hidden / sm:flex / sm:block / sm:items-center for the
 *               hamburger ↔ ribbon swap on /welcome, sm:mx-auto, sm:my-8,
 *               sm:px-0, sm:w-auto, min-w-[16rem] for /select-bu dropdowns,
 *               plus space-y-2 / border-t for the stacked hamburger menu.
 * =========================================================================
 */

/* ---- Reset (Tailwind preflight slice) ----------------------------------- */
*, ::before, ::after { box-sizing: border-box; border-width: 0; border-style: solid; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; tab-size: 4; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { margin: 0; line-height: inherit; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; margin: 0; }
p, blockquote, dl, dd, hr, figure, pre { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; padding: 0; }
button { background-color: transparent; cursor: pointer; }
a { color: inherit; text-decoration: inherit; }
img, svg { display: block; max-width: 100%; height: auto; }

/* ---- DTL custom palette ------------------------------------------------- */
/* v2.1: the legacy --dtl-green tokens are RETAINED for backwards compat
 * (anything that references them keeps working), but everything new should
 * use the THEME tokens below so the colour follows the active Abteilungs-
 * kategorie. .bg-dtl-green / .text-dtl-green now read from --color-primary
 * via the theme cascade, but keep their visual identity on kategorie=1.
 */
:root {
  --dtl-green: #2E7D32;
  --dtl-green-hover: #256528;
  --dtl-green-light: #E6F4EA;
}

/* ---- v2.1 theming via [data-theme="N"] on <body> ----------------------- */
/* Theme tokens are exposed as CSS custom properties so component classes
 * (.btn-primary, .bg-dtl-green etc.) can read them via var(--color-*).
 *
 * `:root` declares the default theme so unauthenticated pages (login,
 * password-help, error) get a sensible look even though they have no
 * `[data-theme]` on <body>. `[data-theme="1"]` mirrors :root so the cascade
 * is unambiguous when a body DOES carry the attribute.
 *
 * Palettes for kategorie 2/3/4 are currently mirrored on DTL — see
 * themes.py for the rationale. Replace these hex values when the real LMO /
 * FASHIONNET / FASHIONET AT brand colours arrive.
 */
:root {
  --color-primary:       #2E7D32;
  --color-primary-hover: #1B5E20;
  --color-page-bg:       #F1F8F1;
}
[data-theme="1"] {
  --color-primary:       #2E7D32;
  --color-primary-hover: #1B5E20;
  --color-page-bg:       #F1F8F1;
}
[data-theme="2"] {
  --color-primary:       #2E7D32;
  --color-primary-hover: #1B5E20;
  --color-page-bg:       #F1F8F1;
}
[data-theme="3"] {
  --color-primary:       #2E7D32;
  --color-primary-hover: #1B5E20;
  --color-page-bg:       #F1F8F1;
}
[data-theme="4"] {
  --color-primary:       #2E7D32;
  --color-primary-hover: #1B5E20;
  --color-page-bg:       #F1F8F1;
}

/* v2.1 themed page-background utility — the login page (and any other
 * page using <body class="... bg-themed-page ...">) follows the active
 * theme's `page_bg` token. Replaces the hard-coded `bg-gray-50` per §7. */
.bg-themed-page { background-color: var(--color-page-bg); }

/* Legacy DTL classes now point at the theme variable so any markup that
 * still references them automatically picks up theme changes. The fallback
 * hex is preserved as a comment so a future grep -> # value is easy. */
.text-dtl-green   { color: var(--color-primary); }                    /* was #2E7D32 */
.bg-dtl-green     { background-color: var(--color-primary); }         /* was #2E7D32 */
.bg-dtl-green-light { background-color: var(--dtl-green-light); }     /* legacy, no theme variant yet */
.border-dtl-green { border-color: var(--color-primary); }             /* was #2E7D32 */
.ring-dtl-green:focus { box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.4); }

/* ---- Typography --------------------------------------------------------- */
.font-sans   { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.font-mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }
.text-xs   { font-size: 0.75rem;  line-height: 1rem; }
.text-sm   { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem;     line-height: 1.5rem; }
.text-lg   { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl   { font-size: 1.25rem;  line-height: 1.75rem; }
.text-2xl  { font-size: 1.5rem;   line-height: 2rem; }
.text-3xl  { font-size: 1.875rem; line-height: 2.25rem; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.uppercase   { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-snug  { line-height: 1.375; }

/* ---- Colours (greyscale + status) -------------------------------------- */
.text-white      { color: #ffffff; }
.text-gray-400   { color: #9ca3af; }
.text-gray-500   { color: #6b7280; }
.text-gray-600   { color: #4b5563; }
.text-gray-700   { color: #374151; }
.text-gray-900   { color: #111827; }
.text-red-600    { color: #dc2626; }
.text-red-700    { color: #b91c1c; }
.text-blue-600   { color: #2563eb; }
.text-blue-700   { color: #1d4ed8; }
.text-yellow-700 { color: #a16207; }

.bg-white     { background-color: #ffffff; }
.bg-gray-50   { background-color: #f9fafb; }
.bg-gray-100  { background-color: #f3f4f6; }
.bg-gray-200  { background-color: #e5e7eb; }
.bg-gray-800  { background-color: #1f2937; }
.bg-red-50    { background-color: #fef2f2; }
.bg-blue-50   { background-color: #eff6ff; }
.bg-yellow-50 { background-color: #fefce8; }

/* 2026-05-20 — Dev-Info-Box auf der Generic-Error-Seite. Wird NUR
 * gerendert wenn `error_detail` im Template gesetzt ist; das Visibility-
 * Gate (`ENVIRONMENT != 'live'`) liegt server-seitig in `_render_error_page`.
 * Bewusst eigene Klassen (kein Tailwind-Mix) — die Komponente erscheint
 * exakt an einer Stelle und soll als „Dev-Only-Hack" visuell erkennbar
 * bleiben. CSP-konform (kein Inline-Style). */
.error-dev-info-wrap {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}
.error-dev-info-box {
  background-color: #fefce8;              /* yellow-50 */
  border-left: 4px solid #eab308;         /* yellow-500 */
  border-radius: 0 6px 6px 0;
  padding: 1rem;
}
.error-dev-info-title {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #713f12;                         /* yellow-900 */
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.error-dev-info-pre {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #1f2937;                         /* gray-800 */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow-x: auto;
}

.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-red-300  { border-color: #fca5a5; }
.border-blue-300 { border-color: #93c5fd; }
.border-yellow-300 { border-color: #fde047; }

/* ---- Layout (display + flex + grid) ----------------------------------- */
.block        { display: block; }
.inline       { display: inline; }
.inline-block { display: inline-block; }
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.grid         { display: grid; }
.hidden       { display: none; }

.flex-1       { flex: 1 1 0%; }
.flex-col     { flex-direction: column; }
.flex-row     { flex-direction: row; }
.flex-wrap    { flex-wrap: wrap; }
.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---- Sizing ----------------------------------------------------------- */
.h-4        { height: 1rem; }
.h-6        { height: 1.5rem; }
.h-8        { height: 2rem; }
.h-10       { height: 2.5rem; }
.h-12       { height: 3rem; }
.h-16       { height: 4rem; }
.h-full     { height: 100%; }
.h-screen   { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.w-4        { width: 1rem; }
.w-6        { width: 1.5rem; }
.w-8        { width: 2rem; }
.w-10       { width: 2.5rem; }
.w-12       { width: 3rem; }
.w-16       { width: 4rem; }
.w-full     { width: 100%; }
.w-auto     { width: auto; }
.max-w-xs   { max-width: 20rem; }
.max-w-sm   { max-width: 24rem; }
.max-w-md   { max-width: 28rem; }
.max-w-lg   { max-width: 32rem; }
.max-w-xl   { max-width: 36rem; }
.max-w-2xl  { max-width: 42rem; }
.max-w-3xl  { max-width: 48rem; }
.max-w-4xl  { max-width: 56rem; }

/* ---- Spacing — padding ------------------------------------------------ */
.p-0  { padding: 0; }
.p-1  { padding: 0.25rem; }
.p-2  { padding: 0.5rem; }
.p-3  { padding: 0.75rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.p-8  { padding: 2rem; }
.px-2 { padding-left: 0.5rem;  padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem;    padding-right: 1rem; }
.px-6 { padding-left: 1.5rem;  padding-right: 1.5rem; }
.px-8 { padding-left: 2rem;    padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem;  padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem;    padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem;  padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem;    padding-bottom: 2rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }

/* ---- Spacing — margin ------------------------------------------------- */
.m-0   { margin: 0; }
.m-2   { margin: 0.5rem; }
.m-4   { margin: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-2  { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-4  { margin-top: 1rem;   margin-bottom: 1rem; }
.my-6  { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem; }
.ml-2  { margin-left: 0.5rem; }
.ml-4  { margin-left: 1rem; }
.mr-2  { margin-right: 0.5rem; }
.mr-4  { margin-right: 1rem; }

/* ---- Border + radius -------------------------------------------------- */
.border       { border-width: 1px; }
.border-2     { border-width: 2px; }
.border-t     { border-top-width: 1px; }
.border-b     { border-bottom-width: 1px; }
.border-l-4   { border-left-width: 4px; }
.rounded      { border-radius: 0.25rem; }
.rounded-md   { border-radius: 0.375rem; }
.rounded-lg   { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999rem; }

/* ---- Shadows ---------------------------------------------------------- */
.shadow      { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06); }
.shadow-sm   { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.shadow-md   { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1); }
.shadow-lg   { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }

/* ---- Positioning ------------------------------------------------------ */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.static   { position: static; }
.sticky   { position: sticky; top: 0; }
.top-0    { top: 0; }
.top-full { top: 100%; }
.right-0  { right: 0; }
.left-0   { left: 0; }
.bottom-0 { bottom: 0; }
.z-10     { z-index: 10; }
.z-20     { z-index: 20; }
.z-50     { z-index: 50; }

/* ---- Misc utilities --------------------------------------------------- */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.whitespace-nowrap { white-space: nowrap; }
.opacity-50      { opacity: 0.5; }
.opacity-75      { opacity: 0.75; }
.cursor-pointer  { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.transition      { transition: all 150ms ease-in-out; }
.duration-150    { transition-duration: 150ms; }
.list-disc       { list-style: disc; padding-left: 1.5rem; }

/* ---- Form controls --------------------------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  /* v2.1: theme-driven focus ring. Fallback hex #2E7D32 (DTL-Grün) via :root. */
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

/* ---- Custom component classes ---------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  /* v2.1 — use the theme tokens. Falls back to DTL-Grün via :root.
   * Hex of fallback: #2E7D32 (primary), #1B5E20 (hover). */
  background-color: var(--color-primary);
  color: #ffffff;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-primary);
  transition: background-color 150ms ease-in-out;
  cursor: pointer;
}
.btn-primary:hover { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-primary:focus { outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background-color: #ffffff;
  color: #374151;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  transition: background-color 150ms ease-in-out;
  cursor: pointer;
}
.btn-secondary:hover { background-color: #f3f4f6; }
.btn-secondary:focus { outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }

/* DocBridge button aliases (2026-05-24): the docbridge-* classes were used
 * widely across all etappen but never defined as CSS — <button> tags
 * looked OK via browser default, but <a class="docbridge-btn-*"> tags
 * fell back to default-link styling (underlined blue text). Alias them
 * to the portal's standard btn-primary / btn-secondary so anchors
 * styled as buttons render correctly. */
.docbridge-btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem;
  background-color: var(--color-primary); color: #ffffff;
  font-weight: 500; font-size: 0.875rem; line-height: 1.25rem;
  border-radius: 0.375rem; border: 1px solid var(--color-primary);
  transition: background-color 150ms ease-in-out;
  cursor: pointer; text-decoration: none;
}
.docbridge-btn-primary:hover { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); color: #ffffff; text-decoration: none; }
.docbridge-btn-primary:focus { outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.4); }
.docbridge-btn-primary:disabled,
.docbridge-btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }

.docbridge-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem;
  background-color: #ffffff; color: #374151;
  font-weight: 500; font-size: 0.875rem; line-height: 1.25rem;
  border-radius: 0.375rem; border: 1px solid #d1d5db;
  transition: background-color 150ms ease-in-out;
  cursor: pointer; text-decoration: none;
}
.docbridge-btn-secondary:hover { background-color: #f3f4f6; color: #374151; text-decoration: none; }
.docbridge-btn-secondary:focus { outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }

/* HDB-REFINE-6 (2026-05-18, PORTAL_VERSION 0.4.84) — Ghost-Button für den
 * Abbrechen-Pfad im Editor-Footer. Steht neben .btn-primary (DTL-Grün) und
 * .btn-secondary (Vorschau, white-outlined); soll bewusst zurücktreten, ohne
 * wie nackter Linktext zu wirken. Transparente Border + matching Padding
 * halten die Höhe identisch zu den anderen Buttons in der Action-Row. */
.btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background-color: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  transition: background-color 150ms ease-in-out, color 150ms ease-in-out;
  cursor: pointer;
  text-decoration: none;
}
.btn-tertiary:hover { background-color: #f3f4f6; color: #374151; }
.btn-tertiary:focus { outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }
.btn-tertiary:disabled { opacity: 0.5; cursor: not-allowed; }

.error-banner {
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.info-banner {
  background-color: #eff6ff;
  border: 1px solid #93c5fd;
  border-left: 4px solid #2563eb;
  color: #1d4ed8;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.debug-box {
  background-color: #1f2937;
  color: #f3f4f6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  padding: 1rem;
  border-radius: 0.375rem;
  margin-top: 1.5rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ---- Spacing — extra utilities for mobile-stack layouts -------------- */
/* space-y-N applies margin-top to every child after the first — used by the
 * hamburger menu's vertical stack so we don't have to repeat mt-* on each
 * <li>. The :where() keeps specificity at 0,1,0 so individual mt-* still wins. */
.space-y-1 > :where(* + *) { margin-top: 0.25rem; }
.space-y-2 > :where(* + *) { margin-top: 0.5rem; }
.space-y-3 > :where(* + *) { margin-top: 0.75rem; }
.space-y-4 > :where(* + *) { margin-top: 1rem; }
.space-y-6 > :where(* + *) { margin-top: 0.25rem; }  /* REFINE-5: tight breathing room between sections. */

/* min-width helpers — used on /select-bu to give the dropdowns a sensible
 * lower-bound on desktop while staying full-width on mobile. */
.min-w-0       { min-width: 0; }
.min-w-\[16rem\] { min-width: 16rem; }

/* ---- Responsive breakpoint helpers (sm: 640px, md: 768px) ----------- */
@media (min-width: 640px) {
  /* layout */
  .sm\:block        { display: block; }
  .sm\:inline-block { display: inline-block; }
  .sm\:flex         { display: flex; }
  .sm\:inline-flex  { display: inline-flex; }
  .sm\:hidden       { display: none; }
  .sm\:flex-row     { flex-direction: row; }
  .sm\:flex-col     { flex-direction: column; }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
  /* sizing */
  .sm\:w-auto       { width: auto; }
  .sm\:w-full       { width: 100%; }
  .sm\:flex-1       { flex: 1 1 0%; }
  .sm\:max-w-md     { max-width: 28rem; }
  .sm\:min-w-\[16rem\] { min-width: 16rem; }
  /* spacing */
  .sm\:mx-auto      { margin-left: auto; margin-right: auto; }
  .sm\:my-8         { margin-top: 2rem; margin-bottom: 2rem; }
  .sm\:mt-0         { margin-top: 0; }
  .sm\:px-0         { padding-left: 0; padding-right: 0; }
  .sm\:px-6         { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:py-2         { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  /* misc */
  .sm\:border-0     { border-width: 0; }
  .sm\:space-y-0 > :where(* + *) { margin-top: 0; }
  /* v2.1 ribbon dropdown overrides: at sm and up, the mobile dropdown's
   * absolute positioning + shadow + white background are undone so the
   * ribbon sits in-flow like the desktop layout. */
  .sm\:static       { position: static; }
  .sm\:top-auto     { top: auto; }
  .sm\:z-auto       { z-index: auto; }
  .sm\:bg-gray-100  { background-color: #f3f4f6; }
  .sm\:shadow-none  { box-shadow: none; }
}
@media (min-width: 768px) {
  .md\:grid-cols-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:flex         { display: flex; }
  .md\:px-8         { padding-left: 2rem; padding-right: 2rem; }
}

/* ---- SDG-3.1 — Sendungsmaske topbar additions -------------------------- */
/* Emoji-friendly font stack. The base `html` rule (top of this file) already
 * sets a Latin font stack; we extend it with the OS-native colour-emoji
 * families so flag glyphs (🇩🇪 🇨🇭 🇦🇹 …) render as colour pictographs
 * instead of monochrome `RI`-pair fallbacks. Body wins over html because of
 * inheritance order — set on both for safety. */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial,
               "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
               sans-serif;
}

/* Utility helpers used by `_topbar_search.html` that weren't present yet. */
.w-5      { width: 1.25rem; }
.h-5      { height: 1.25rem; }
.mx-3     { margin-left: 0.75rem; margin-right: 0.75rem; }
.mx-4     { margin-left: 1rem;    margin-right: 1rem; }
.inset-x-0 { left: 0; right: 0; }

/* Component classes for the topbar Sendung-search input + leading icon.
 * The project's global `input[type="text"]` selector (above) already sets
 * width/padding/border/etc.; this component override:
 *   * leaves room (pl-9) for the absolutely-positioned magnifier icon
 *   * keeps the input visually small (text-sm) inside the topbar
 *   * positions the icon at the input's left edge, vertically centred
 *
 * Inline `style` attributes ARE allowed under CSP — only inline <script>
 * and <style> BLOCKS are forbidden — but a class keeps markup tidy. */
/* REFINE-10: selector includes the `input` tag so specificity (0,0,1,1) ties
   with the global `input[type="text"]` rule above — and our source-order
   wins the tiebreak. Without the `input` prefix, `.topbar-search-input`
   had specificity 0,0,1,0 and lost to the global, so the left-padding
   never applied and the lupe-icon overlapped the placeholder. */
input.topbar-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;  /* pl-9 == 2.25rem */
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;
}
input.topbar-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.topbar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  color: #9ca3af;            /* matches text-gray-400 */
  transform: translateY(-50%);
  pointer-events: none;
}

/* ---- SDG-4.1 — Sendungsmaske search/empty-state page ------------------ */
/* The mockup (attachments/sendung-suche.html) uses CSS custom properties
 * --dtl-primary-soft (#E8F2E9) and --dtl-primary-dark (#163E18). The
 * project's curated subset doesn't expose those as tokens yet; we inline
 * the hex values directly so we don't disturb the existing theme cascade
 * (which only knows --color-primary / --color-primary-hover / --color-page-bg).
 * If the theme system later grows soft/dark tokens, replace the literal
 * hex below with `var(--color-primary-soft)` etc. — markup stays the same.
 *
 * Component vocabulary:
 *   .hero-suche              — the centred hero section wrapper
 *   .hero-eyebrow            — soft-green pill above the headline
 *   .hero-eyebrow-dot        — small filled dot inside the eyebrow
 *   .hero-headline           — the big bold "Sendung finden, …" h1
 *   .hero-headline-accent    — the green "finden" word inside the headline
 *   .hero-lead               — the descriptive paragraph below the headline
 *   .search-card             — the white rounded card wrapping input+button
 *   .search-card-input       — the relatively-positioned wrapper for the
 *                              icon + the actual <input>
 *   .search-card-input-icon  — the magnifier glyph at the input's left edge
 *   .search-card-submit      — the "Suchen" button width on >= sm so the
 *                              btn-primary base class doesn't squash it
 *   .search-card-error       — inline red box for the 404 / not-found case
 *   .hero-examples           — flex row of example chips
 *   .example-chip            — single pill-shaped example button
 *   .example-chip-label      — uppercase eyebrow inside a chip (Master / Pck …)
 *   .example-chip-value      — monospace shipment number inside a chip
 *   .tips-grid               — the three-card hint section below the hero
 *   .tip-card                — single hint card
 *   .tip-card-title          — first-line h-like label of a hint card
 *   .tip-card-body           — descriptive body of a hint card
 */

.hero-suche {
  max-width: 48rem;            /* same as max-w-3xl */
  margin: 0 auto;
  padding: 3rem 1rem;          /* py-12 px-4 mobile-first */
  text-align: center;
}
@media (min-width: 640px) {
  .hero-suche {
    padding: 5rem 2rem;        /* py-20 px-8 from sm: up */
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: #E8F2E9;          /* --dtl-primary-soft */
  color: #163E18;               /* --dtl-primary-dark */
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.75rem;       /* mb-7 */
}
.hero-eyebrow-dot {
  width: 0.375rem;
  height: 0.375rem;
  background: var(--color-primary);
  border-radius: 50%;
  display: inline-block;
}

.hero-headline {
  font-size: 1.875rem;          /* text-3xl on mobile */
  font-weight: 800;             /* font-extrabold */
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: #111827;               /* text-gray-900 */
  margin-bottom: 1.125rem;      /* mb-4-ish */
}
@media (min-width: 640px) {
  .hero-headline {
    font-size: 2.75rem;         /* close to text-5xl, matches mockup 44px */
  }
}
.hero-headline-accent {
  color: var(--color-primary);
}

.hero-lead {
  font-size: 1rem;              /* text-base mobile */
  color: #4b5563;               /* text-gray-600 */
  line-height: 1.5;
  max-width: 42rem;             /* max-w-2xl */
  margin: 0 auto 2.25rem;       /* mb-9 */
}
@media (min-width: 640px) {
  .hero-lead {
    font-size: 1.125rem;        /* text-lg */
  }
}

.search-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;          /* rounded-2xl-ish */
  padding: 1rem;
  box-shadow: 0 20px 50px -20px rgba(22, 62, 24, 0.15),
              0 4px 12px -4px  rgba(22, 62, 24, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 36rem;             /* max-w-xl */
  margin: 0 auto;
  align-items: stretch;
}
@media (min-width: 640px) {
  .search-card {
    flex-direction: row;
    padding: 1.5rem;
  }
}

.search-card-input {
  position: relative;
  flex: 1 1 0%;
}
.search-card-input input {
  /* Override the global input rule so we get the bigger hero-style field. */
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;  /* room on the left for the icon */
  border: 1.5px solid #e5e7eb;
  border-radius: 0.625rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: #ffffff;
  color: #111827;
  transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
}
.search-card-input input::placeholder {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  color: #A0AEA6;
}
.search-card-input input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.12);
}
.search-card-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-primary);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-card-submit {
  /* Tighter than the default btn-primary so it visually balances the
   * tall hero input. Falls back to btn-primary's colours + hover. */
  padding: 1rem 1.75rem;        /* py-4 px-7 */
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 0.625rem;
  white-space: nowrap;
}

.search-card-error {
  margin: 1.5rem auto 0;
  max-width: 36rem;             /* matches .search-card max-width */
  padding: 0.875rem 1rem;
  background: #fef2f2;          /* bg-red-50 */
  border: 1px solid #fca5a5;    /* border-red-300 */
  color: #991B1B;               /* darker red than .error-banner for legibility */
  border-radius: 0.5rem;
  font-size: 0.875rem;
  text-align: left;
}
.search-card-error strong { font-weight: 600; }

.hero-examples {
  margin-top: 2.25rem;          /* mt-9 */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.example-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem 0.5rem 0.75rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: #4b5563;
  cursor: pointer;
  transition: border-color 150ms ease-in-out,
              background-color 150ms ease-in-out,
              box-shadow 150ms ease-in-out;
}
.example-chip:hover {
  border-color: var(--color-primary);
  background: #E8F2E9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.example-chip:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.example-chip-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #163E18;               /* --dtl-primary-dark */
}
.example-chip-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;
  font-weight: 500;
  color: #111827;
}

.tips-grid {
  max-width: 56rem;             /* max-w-4xl */
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;    /* py-12 with px-4 on mobile */
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .tips-grid {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
@media (min-width: 768px) {
  .tips-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tip-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: left;
  transition: border-color 200ms ease-in-out,
              box-shadow 200ms ease-in-out,
              transform 200ms ease-in-out;
}
.tip-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px -8px rgba(22, 62, 24, 0.15);
  transform: translateY(-2px);
}
.tip-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.375rem;
}
.tip-card-body {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.5;
}

/* =========================================================================
 * Sendung detail page components (SDG-5.1 .. SDG-5.4)
 * =========================================================================
 *
 * Sections owned:
 *   .sendung-kopfzeile / .kopfzeile-*  (SDG-5.1)
 *   .section / .section-head / .auftrag-* / .pod-* (SDG-5.2)
 *   .mengen-* / .mengen-pod-row / .mengen-inline-row / .mengen-cell-inline (SDG-5.3, REFINE-3/4)
 *   .table-wrap / .data-table (SDG-5.3)
 *   .pck-row / .badge-master / .chev / .pck-scan-panel (SDG-5.4)
 *
 * Palette tokens (introduced for this phase — additive, not replacing
 * existing tokens):
 *   --dtl-green-dark   matches the mockup's --dtl-primary-dark (#163E18)
 *   --dtl-green-soft   matches the mockup's --dtl-primary-soft (#E8F2E9)
 *   --dtl-ink, --dtl-ink-soft, --dtl-ink-fade, --dtl-line, --dtl-line-soft
 *
 * Visibility note (visibility-toggles.md):
 *   .pck-scan-panel intentionally has NO `display:*` declaration in its
 *   static class. The `hidden` HTML attribute (UA-stylesheet `display:none`)
 *   controls visibility together with a JS-toggled `.block` class.
 * ========================================================================= */

:root {
  --dtl-green-dark:    #163E18;
  --dtl-green-soft:    #E8F2E9;
  --dtl-ink:           #0F1B12;
  --dtl-ink-soft:      #4B5A50;
  --dtl-ink-fade:      #8A9A91;
  --dtl-line:          #E1E9E3;
  --dtl-line-soft:     #EEF3EF;
  --badge-blue-bg:     #DBEAFE;
  --badge-blue-fg:     #1E40AF;
  --badge-green-bg:    #DCFCE7;
  --badge-green-fg:    #166534;
  --badge-yellow-bg:   #FEF3C7;
  --badge-yellow-fg:   #92400E;
  --badge-gray-bg:     #F3F4F6;
  --badge-gray-fg:     #374151;
}

/* Hover/text variant for the dark-green ink used in breadcrumbs etc. */
.text-dtl-green-dark      { color: var(--dtl-green-dark); }
.hover\:text-dtl-green-dark:hover { color: var(--dtl-green-dark); }

.whitespace-nowrap { white-space: nowrap; }

/* ---- §1 Kopfzeile (SDG-5.1) -------------------------------------------- */
.sendung-kopfzeile {
  background: linear-gradient(135deg, var(--dtl-green-dark) 0%, var(--color-primary) 100%);
  color: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(22, 62, 24, 0.35);
}
.sendung-kopfzeile::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  top: -120px;
  right: -120px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.kopfzeile-id { flex-shrink: 0; position: relative; z-index: 1; }
.kopfzeile-master {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}
.kopfzeile-tracking {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.kopfzeile-tracking-label {
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.kopfzeile-meta {
  display: grid;
  /* REFINE-9d: 5 Cells — Status | Standort | Datum (each 1fr, evenly spread
     across left/middle) | Ampel | Prozess (each auto, content-sized). */
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 1.25rem 1.5rem;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}
.kopfzeile-meta-cell { min-width: 0; }
/* Icon cells just center their <img> child. */
.kopfzeile-meta-cell-icon {
  display: flex;
  align-items: center;
}
/* REFINE-9e: gönne den beiden Icons etwas Abstand zu den Action-Buttons
   (S — Anfrage / Schließen) rechts daneben. Wirkt auf die letzte
   Meta-Cell (= Prozess-Icon). */
.kopfzeile-meta-cell-icon:last-child {
  margin-right: 3rem;
}
.kopfzeile-meta-label {
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.25rem;
}
.kopfzeile-meta-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #ffffff;
  word-break: break-word;
}

/* REFINE-9: §1-Kopfzeile status icons — liegende Ampel + Prozess-Icon.
   Sits between .kopfzeile-meta (which is `flex:1` and eats remaining space)
   and .kopfzeile-actions. Meta therefore stretches and pushes both this
   group and the action buttons to the right end of the header. Icons are
   ~40px tall so they line up with the action buttons; width is auto so the
   liegende-Ampel's natural aspect ratio is preserved. */
/* REFINE-9b: Ampel + Prozess-Symbol now sit inside the meta grid (no more
   .kopfzeile-status wrapper). 40px tall, 10px rounded corners. */
.kopfzeile-ampel,
.kopfzeile-prozess {
  height: 40px;
  width: auto;
  display: block;
  border-radius: 10px;
}

.kopfzeile-actions {
  display: flex;
  gap: 0.625rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.btn-action {
  padding: 0.625rem 1.125rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 150ms ease-in-out, border-color 150ms ease-in-out;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn-action:hover  { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); }
.btn-action:focus  { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); }
.btn-action-primary {
  background: #ffffff;
  color: var(--dtl-green-dark);
  border-color: #ffffff;
}
.btn-action-primary:hover { background: var(--dtl-green-soft); border-color: #ffffff; color: var(--dtl-green-dark); }

@media (max-width: 720px) {
  .sendung-kopfzeile {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }
  .kopfzeile-master { font-size: 1.5rem; }
  .kopfzeile-meta   { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}

/* ---- §2/§3 Section + Auftragslegende + POD (SDG-5.2) ------------------- */
.section {
  background: #ffffff;
  border: 1px solid var(--dtl-line);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.125rem;
  flex-wrap: wrap;
}
.section-num {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--dtl-green-soft);
  color: var(--dtl-green-dark);
  border-radius: 0.375rem;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.section-title {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--dtl-ink);
}
.section-hint {
  font-size: 0.75rem;
  color: var(--dtl-ink-soft);
  margin-left: auto;
}

.auftrag-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}
@media (min-width: 768px) {
  .auftrag-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .auftrag-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Auftragslegende column — compact TYPO3-legacy tabular look (REFINE-1).
   No padding, no inner gap; rows sit flush against the column edges and
   stack directly under one another. The column-title is a flat gray bar
   at the top, separated from the first row by its own border only. */
.auftrag-col {
  padding: 0;
  background: var(--color-page-bg);
  border: 1px solid var(--dtl-line-soft);
  border-radius: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.auftrag-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--dtl-ink);
  background: #f3f4f6;
  padding: 0.375rem 0.625rem;
  border-bottom: 1px solid var(--dtl-line);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
/* Legacy `.auftrag-col-tag` chip retained for any non-§2 callers; the
   refined §2 markup embeds TAP/TEP inline in the title text instead. */
.auftrag-col-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.625rem;
  padding: 0.0625rem 0.375rem;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 0.25rem;
  letter-spacing: 0;
}

/* Compact tabular row inside an .auftrag-col. ~30px row height, hairline
   separator between rows, no inter-row gap. */
.auftrag-row {
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--dtl-ink);
  padding: 0.3125rem 0.625rem;
  border-bottom: 1px solid #e5e7eb;
  word-break: break-word;
}
.auftrag-row:last-child {
  border-bottom: 0;
}
.auftrag-row-strong {
  font-weight: 700;
}
.auftrag-row-label {
  color: #6b7280;
  margin-right: 0.25rem;
}
/* Invisible single-row spacer used to push trailing fields (e.g. Referenz
   in Col 1, Warenwert in Col 2) down by one row so they sit on a shared
   baseline across columns. Matches .auftrag-row's vertical footprint
   exactly (same padding + line-height) but renders no text and no
   bottom hairline, reading as a clean visual gap. REFINE-1b. */
.auftrag-row-spacer {
  border-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  /* one row's worth of vertical space: line-height 1.3 × font-size
     0.8125rem ≈ 1.056rem, plus the 0.3125rem top+bottom padding of a
     real row = ~1.681rem. */
  height: 1.6875rem;
}

/* Legacy .auftrag-field rules — retained for backwards-compat with any
   downstream callers; §2 no longer emits these classes after REFINE-1. */
.auftrag-field {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}
.auftrag-field-label {
  font-size: 0.65rem;
  color: var(--dtl-ink-fade);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 600;
}
.auftrag-field-value {
  font-size: 0.84rem;
  color: var(--dtl-ink);
  font-weight: 500;
  word-break: break-word;
}

/* POD signature card (Spalte 4) — tightened padding to match the new
   compact density of the surrounding columns. */
.pod-signature {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem 0.625rem 0.625rem;
  background: #ffffff;
  gap: 0.375rem;
}
.pod-signature-img {
  width: 4rem;
  height: 4rem;
  background: var(--dtl-green-soft);
  color: var(--color-primary);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.pod-signature-status {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.025em;
}
.pod-signature-status-zugestellt { color: var(--color-primary); }
.pod-signature-status-unterwegs  { color: var(--dtl-ink-soft); }
.pod-signature-desc {
  font-size: 0.72rem;
  color: var(--dtl-ink-soft);
  line-height: 1.4;
}
.pod-signature-by {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--dtl-ink);
}

/* §3 POD-Dropdown */
.pod-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pod-select-wrap {
  flex: 1;
  min-width: 17.5rem;
  position: relative;
}
.pod-select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--dtl-line);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.84rem;
  background: #ffffff;
  cursor: pointer;
  color: var(--dtl-ink);
}
.pod-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.btn-pod-show {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.pod-empty {
  padding: 0.75rem 0.9rem;
  border: 1px dashed var(--dtl-line);
  border-radius: 0.5rem;
  background: var(--color-page-bg);
  width: 100%;
}

/* ---- §3 Mengenlegende (SDG-5.3) ---------------------------------------- */

/* REFINE-4 — Flex wrapper that places the Mengenlegende (now §3, left) and
   the POD-Dropdown (now §4, right) side-by-side on lg+ viewports.
   - Mengenlegende: `flex: 0 0 auto` — only takes the width its content needs.
   - POD-Dropdown:  `flex: 1 1 auto` — fills the remaining space.
   On <lg viewports the row stacks (Mengenlegende above POD), restoring the
   original single-column layout for mobile/tablet portrait. */
.mengen-pod-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}
@media (min-width: 1024px) {
  .mengen-pod-row {
    flex-direction: row;
    align-items: stretch;
    gap: 1.25rem;
  }
  .mengen-pod-row > .mengen-section { flex: 0 0 auto; }
  .mengen-pod-row > .pod-section    { flex: 1 1 auto; min-width: 0; }
}

/* REFINE-4 — inline-label row inside the Mengenlegende. One row per legend
   (HÄNGEWARE / PACKSTÜCKE); the label sits on the same baseline as the cells
   rather than as a heading above them. `white-space: nowrap` keeps each row
   on a single line so the legend stays compact; the parent section is
   `flex: 0 0 auto` so its width expands to fit the widest row. Multiple rows
   stack vertically via the row gap. */
.mengen-inline-row {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 1rem;
}
.mengen-inline-row + .mengen-inline-row { margin-top: 0.5rem; }
.mengen-inline-row .mengen-row-label {
  flex: 0 0 auto;
  min-width: 7rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dtl-ink-fade);
  margin-right: 0;
}
.mengen-cell-inline {
  font-size: 0.8125rem;
  color: var(--dtl-ink-soft);
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  /* REFINE-5: badge look with border + padding restored (was inline-prefix only). */
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--dtl-line);
  border-radius: 0.375rem;
  background: #fff;
  white-space: nowrap;
}
.mengen-cell-inline .mengen-cell-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 500;
  color: var(--dtl-ink-fade);
}
.mengen-cell-inline .mengen-cell-count {
  font-weight: 700;
  color: var(--dtl-green-dark);
}

/* REFINE-5: Visual gap between HÄNGEWARE-Block und PACKSTÜCKE-Block when both
   appear on the same row. Wider than the default flex `gap` so the eye
   registers it as a section divider, not just another cell-to-cell spacing. */
.mengen-section-divider {
  flex: 0 0 auto;
  width: 1.5rem;
}

/* REFINE-6: thin vertical inline separator inside an .auftrag-row — used to
   split Volumen | Gewicht onto one row with a visible divider. */
.auftrag-inline-sep {
  display: inline-block;
  width: 1px;
  height: 0.9em;
  background: var(--dtl-line);
  vertical-align: middle;
  margin: 0 0.6rem;
}

/* REFINE-7: Scanlegende Master (§5) is collapsible. Default state hides every
   tbody row EXCEPT the last (most recent) — that one stays visible as a
   preview of the current scan status. Click the toggle button to expand.

   Visibility-toggles compliance: no `display:*` Tailwind utility in the
   static class list of any element below — the parent `data-scans-expanded`
   attribute drives both row-visibility and the label swap. */
.scans-master-section:not([data-scans-expanded="true"]) tbody tr:not(:last-child) {
  display: none;
}
.section-toggle-btn {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--color-primary);
  border-radius: 0.375rem;
  background: #fff;
  color: var(--color-primary);
  cursor: pointer;
}
.section-toggle-btn:hover {
  background: var(--color-primary);
  color: #fff;
}
.section-toggle-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.section-toggle-label-expanded { display: none; }
.scans-master-section[data-scans-expanded="true"] .section-toggle-label-collapsed { display: none; }
.scans-master-section[data-scans-expanded="true"] .section-toggle-label-expanded { display: inline; }

/* REFINE-7b: in the Scanlegende-Master section, push the count-hint to the
   far right so the toggle button sits left-of-it (between title and hint),
   matching the user's annotated layout. Scoped to this section only — other
   .section-hint elsewhere keep their natural flow. */
.scans-master-section .section-hint { margin-left: auto; }

/* Legacy `.mengen-row` / `.mengen-cell` rules retained as a defensive
   fallback. No in-tree template emits them after REFINE-4 (the §3 template
   now emits `.mengen-inline-row` + `.mengen-cell-inline`); keeping the rules
   in place avoids regressing any future caller that copies the old markup. */
.mengen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
}
.mengen-row-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dtl-ink-fade);
  margin-right: 0.375rem;
}
.mengen-cell {
  padding: 0.5rem 0.875rem;
  background: var(--color-page-bg);
  border: 1px solid var(--dtl-line-soft);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--dtl-ink);
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}
.mengen-cell-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 600;
  color: var(--dtl-green-dark);
}
.mengen-cell-count {
  font-weight: 700;
  font-size: 0.9375rem;
}
/* REFINE-3/4 dormant — `.is-zero` no longer emitted; rule kept defensively. */
.mengen-cell.is-zero  .mengen-cell-count { color: var(--dtl-ink-fade); }
.mengen-cell.is-active {
  background: var(--dtl-green-soft);
  border-color: var(--color-primary);
}
.mengen-cell.is-active .mengen-cell-label,
.mengen-cell.is-active .mengen-cell-count { color: var(--dtl-green-dark); }

/* ---- Tables (§5, §6, §7) ----------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--dtl-line);
  border-radius: 0.625rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.data-table thead th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  background: var(--color-page-bg);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dtl-ink-soft);
  border-bottom: 1px solid var(--dtl-line);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--dtl-line-soft);
  color: var(--dtl-ink);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-page-bg); }
.data-table tbody tr:nth-child(even) { background: rgba(241, 248, 241, 0.4); }
.data-table tbody tr:nth-child(even):hover { background: var(--color-page-bg); }

/* Badges — Phase 7 (SDG-7.1) overrides the badge_class macro to pick one
 * of the four colour variants per §13. Phase 5 ships the variants so the
 * macro switch is purely Python-side. */
.badge {
  display: inline-block;
  padding: 0.1875rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-blue   { background: var(--badge-blue-bg);   color: var(--badge-blue-fg); }
.badge-green  { background: var(--badge-green-bg);  color: var(--badge-green-fg); }
.badge-yellow { background: var(--badge-yellow-bg); color: var(--badge-yellow-fg); }
.badge-gray   { background: var(--badge-gray-bg);   color: var(--badge-gray-fg); }

/* ---- §6 Packstückliste rows (SDG-5.4) ---------------------------------- */
.packstueck-table tbody tr.pck-row { cursor: pointer; transition: background-color 120ms ease-in-out; }
.packstueck-table tbody tr.pck-row.is-master { cursor: default; }
.packstueck-table tbody tr.pck-row.is-active {
  background: var(--dtl-green-soft) !important;
  border-left: 3px solid var(--color-primary);
}
.packstueck-table tbody tr.pck-row.is-active td:first-child { padding-left: calc(0.875rem - 3px); }
.packstueck-table tbody tr.pck-row:focus { outline: none; box-shadow: inset 0 0 0 2px var(--color-primary); }

.col-master { width: 2.25rem; }
.col-chev   { width: 2rem; text-align: right; }
/* Inactive chevron points LEFT (180°); when the row is activated it
   rotates 180° clockwise to point RIGHT — toward the detail panel that
   sits on the right since REFINE-2 (side-by-side layout). Gives a visible
   "I now point at your scans" affordance on click. */
.chev {
  display: inline-block;
  transition: transform 200ms ease-in-out, color 200ms ease-in-out;
  color: var(--dtl-ink-fade);
  font-size: 1rem;
  font-weight: 700;
  transform: rotate(180deg);
}
.pck-row.is-active .chev { transform: rotate(0deg); color: var(--color-primary); }

.badge-master {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 800;
  border-radius: 0.375rem;
}

/* ---- §7 Packstück-Scanlegende panel (SDG-5.4) -------------------------
 * IMPORTANT (visibility-toggles.md): no `display:*` declaration on the base
 * .pck-scan-panel rule. Visibility is controlled by:
 *   - HTML `hidden` attribute (UA-stylesheet `display: none`)  → hidden state
 *   - SDG-6.1 JS toggling the `.block` class                    → shown state
 * Layout / appearance properties are fine here; just NOT `display:*`. */
.pck-scan-panel {
  margin-top: 1rem;
  background: var(--dtl-green-soft);
  border: 1px solid var(--color-primary);
  border-radius: 0.75rem;
  overflow: hidden;
}
.pck-scan-panel .section {
  background: #ffffff;
  border-radius: 0;
  border: none;
}
.pck-scan-panel .table-wrap { border: none; border-radius: 0; }

/* ---- SDG-7.1 — Phase-7 polish additions -------------------------------- *
 * The badge variants (.badge / .badge-green / .badge-blue / .badge-yellow /
 * .badge-gray), .badge-master, .table-wrap, the kopfzeile + section +
 * auftrag-* + pod-* + mengen-* component classes, and the .pck-row /
 * .chev / .pck-scan-panel rules were all introduced by SDG-5.1..5.4 and
 * already live above. SDG-7.1 itself only needs to:
 *
 *   1. Pair the JS-toggled `.block` class with `.pck-scan-panel` so the
 *      packstück accordion's "open" state has an explicit, scoped reveal
 *      rule independent of the global `.block` utility — keeps the
 *      visibility-toggles.md contract obvious for future readers.
 *
 *   2. Document that no other CSS additions were required.
 *
 * Per frontend/visibility-toggles.md: `.pck-scan-panel` MUST NOT have a
 * `display:*` declaration in its static class. The HTML `hidden` attribute
 * (UA `display:none`) and the JS-added `.block` class are the one source
 * of visibility state — never both, never neither.
 * ----------------------------------------------------------------------- */
.pck-scan-panel.block { display: block; }

/* ---- REFINE-2 — §6 + §7 side-by-side master/detail split ----------------- *
 * Two-pane layout for the Packstückliste (left ~35%) + Packstück-Scanlegende
 * (right ~65%). On <lg viewports the grid collapses to one column so §6
 * stacks above §7 (original behaviour preserved on tablets/phones).
 *
 * The right pane contains the empty-state placeholder (#packstueck-empty-state)
 * and one .pck-scan-panel per non-master packstück. Both classes honour the
 * visibility-toggles.md contract: NO `display:*` declaration in their static
 * class list — `hidden` attribute + JS-added `.block` class drive visibility.
 * .pck-empty-state.block + .pck-scan-panel.block paired rules below.
 * --------------------------------------------------------------------------- */
.pck-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .pck-split { grid-template-columns: 35% 1fr; gap: 1.25rem; }
}
.pck-split-list { min-width: 0; }
.pck-split-detail { min-width: 0; }
/* Inside the split grid the panel sits flush at the top of the right pane,
   not 1rem below the §6 section as in the original stacked layout. The
   default `.pck-scan-panel { margin-top: 1rem }` above stays for any
   stacked-layout caller, but inside .pck-split the right pane is the panel's
   container so the top margin is dropped to keep both panes top-aligned. */
.pck-split-detail > .pck-scan-panel { margin-top: 0; }

/* Visibility-toggles.md compliance: the base `.pck-empty-state` rule MUST NOT
   declare `display:*`. The `.block` class (added server-side when the empty-
   state is initially visible, and added/removed by JS thereafter) provides
   the only path to a non-`none` display value. Pairing rules:
     - default render with active_pck unset → class="pck-empty-state block" (no hidden attr) → visible
     - default render with active_pck set → class="pck-empty-state" hidden    → hidden
     - JS hide: setAttribute('hidden', '') + classList.remove('block')        → hidden
     - JS show: removeAttribute('hidden')   + classList.add('block')          → visible
   Either `hidden` wins (UA `[hidden]{display:none}`) OR `.block` wins
   (`.pck-empty-state.block { display: flex }`) — never both layered. */
.pck-empty-state {
  border: 1px dashed var(--dtl-line);
  border-radius: 0.75rem;
  background: var(--color-page-bg);
  color: var(--dtl-ink-soft);
  padding: 2.5rem 1.5rem;
  text-align: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 8rem;
}
.pck-empty-state.block { display: flex; }
.pck-empty-state-icon {
  width: 2rem;
  height: 2rem;
  color: var(--dtl-ink-fade);
}
.pck-empty-state-text {
  font-size: 0.875rem;
  line-height: 1.4;
  margin: 0;
}

/* SDG-7.2 hotfix — list-none utility for the ribbon <ul>.
   The curated Tailwind preflight slice lacks a global `ul { list-style: none }`
   reset, so the ribbon ul rendered with native disc markers. */
.list-none { list-style: none; padding-left: 0; }

/* =====================================================================
 * DTL-03 Servicebox (SBX-2.4)
 * Visibility-toggles-safe: never add `flex`/`grid`/`block` to a static
 * markup class list of a default-hidden element. JS toggles the class.
 *
 * NOTE on `.badge-yellow` redefinition: a `.badge-yellow` rule already
 * exists above for the SDG-7.1 `.badge` family (uppercase pill, paired
 * with the `.badge` base). The rule below redefines the colours when
 * used as a STANDALONE count badge (ribbon / matrix / S-button), which
 * is the use-case for DTL-03. Because both rules share the same single-
 * class selector and this one is later in source order, it wins.
 * In practice the older `.badge .badge-yellow` use-sites combine TWO
 * classes — their shape is set by `.badge` (padding/font/text-transform)
 * and only the bg/fg colour is read from `.badge-yellow`. The new colour
 * values are visually equivalent yellow tones; if a downstream visual
 * regression appears, scope this rule with `.servicebox-context
 * .badge-yellow` instead. — flagged for orchestrator review.
 * ===================================================================== */

/* 1. Badges — count pills (matrix / ribbon / S-button) */
.badge-red, .badge-yellow, .badge-dimmed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.badge-red    { background: #dc2626; color: #ffffff; }
.badge-yellow { background: #fbbf24; color: #1f2937; }
.badge-dimmed { background: transparent; color: #6b7280; font-weight: 500; }

/* 2. Visibility-toggle SCOPED rules for modal + panel (critical).
 * Default state: element carries the `hidden` attribute → UA stylesheet
 * `display: none`. JS adds `.flex` to flip to flex. The base
 * `.servicebox-modal` / `.servicebox-panel` rules deliberately do NOT
 * declare `display:*` — only the combined `.X.flex` does. */
.servicebox-modal.flex { display: flex; }
.servicebox-panel.flex { display: flex; }

/* 3. Modal layout */
.servicebox-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 24, 39, 0.5);
  align-items: center;       /* harmless when display=none */
  justify-content: center;
  padding: 1rem;
}
.servicebox-modal-card {
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  /* Refine v3.1: 36rem ließ die Out-Spalte zu weit vom Text wegrutschen
     (Mittelspalte nahm allen Restplatz). 28rem hält die drei Spalten
     kompakt zusammen, ohne dass die längsten Labels umbrechen müssen. */
  max-width: 28rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.servicebox-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}
.servicebox-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
}

/* 4. Anfragetyp matrix table.
   Refine: feste Spaltenbreiten — In/Out je 6rem (Bubbles passen rein),
   Mittelspalte (Anfragetyp) füllt den Rest. Header zentriert UND Body
   zentriert (statt asymmetrisch zentriert/links), damit Spaltenüberschrift
   sauber über der Spalte sitzt. Anfragetyp-Spalte linksbündig in BEIDEN
   (Header + Body) — so springt nichts mehr. */
.servicebox-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
/* Refine v3.4: asymmetrische Spaltenbreiten — links 6rem (EINGEHEND-
   Header passt mittig), rechts 5rem (AUSGEHEND-Header passt ohne Cut,
   Inhalt rückt aber näher zu Spalte 2 als die symmetrischen 6rem). */
.servicebox-matrix col.col-in    { width: 6rem; }
.servicebox-matrix col.col-type  { width: auto; }
.servicebox-matrix col.col-out   { width: 5rem; }
/* Legacy-Selector — falls irgendwo noch col-inout im Markup steht. */
.servicebox-matrix col.col-inout { width: 6rem; }
.servicebox-matrix th,
.servicebox-matrix td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid #f3f4f6;
}
.servicebox-matrix th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
}
/* Anfragetyp-Spalte: Header UND Body linksbündig (sauberer Lesefluss);
   EINGEHEND und AUSGEHEND bleiben über `.servicebox-matrix th` zentriert. */
.servicebox-matrix th:nth-child(2),
.servicebox-matrix td:nth-child(2) { text-align: left; }
/* AUSGEHEND-Spalte: enges Horizontal-Padding, damit der 9-Buchstaben-
   Header in die 5rem-Cell passt, ohne überzulaufen (sonst wirkt das
   `text-align: center` asymmetrisch verschoben). Vertikales Padding
   unverändert für Höhen-Konsistenz mit den Nachbarspalten. */
.servicebox-matrix th:nth-child(3),
.servicebox-matrix td:nth-child(3) { padding-left: 0.25rem; padding-right: 0.25rem; }
.servicebox-matrix-cell-clickable { cursor: pointer; }
.servicebox-matrix-cell-clickable:hover { background: #f9fafb; }
/* Summenzeile am Ende der Matrix — visuell abgesetzt durch dicke Top-
   Border, fetter Text und zarter Background. Keine Hover-Interaktion. */
.servicebox-matrix tfoot tr.matrix-total-row td {
  border-top: 2px solid #e5e7eb;
  background: #f9fafb;
  font-weight: 600;
  color: #111827;
}

/* 5. List view (matrix drill-down).
   Refine: Tabellen-Layout — dunkelgrüner Header-Streifen mit Titel + Zurück-
   Link + Count-Badge, darunter Spalten-Header und Datenzeilen mit
   Chronologie-Sub-Zeilen. Modal wechselt im list-mode auf breitere
   max-width (siehe .servicebox-modal-card-list weiter unten). */
.servicebox-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(180deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 0;
}
.servicebox-list-header-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.servicebox-list-header-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.servicebox-list-header-back {
  color: #d1fae5;
  font-size: 0.8125rem;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.servicebox-list-header-back:hover { color: #ffffff; text-decoration: underline; }
.servicebox-list-header-count {
  background: #dc2626;
  color: #ffffff;
  font-weight: 700;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Grid-Template — shared zwischen thead, data-row und chrono-row, damit
   die Sendungsnummer-Spalte exakt gleich breit ist und der Chronologie-
   Text bündig unter dem "Anfragetyp"-Header startet. Status-Spalte breiter
   (passt "IN BEARBEITUNG" in eine Zeile) und zentriert. */
.servicebox-list-table {
  display: block;
  font-size: 0.875rem;
}
.servicebox-list-thead,
.servicebox-list-row {
  display: grid;
  /* Aktion etwas breiter (4rem → 5.5rem) — bis zu 3 Aktions-Icons +
     Mail-Tooltip-Icon pro Zeile möglich. */
  grid-template-columns: 13rem 8rem 9.5rem 4.5rem 1fr 7.5rem 5.5rem;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  align-items: center;
}
.servicebox-list-thead {
  border-bottom: 1px solid #d1d5db;
  font-weight: 600;
  font-size: 0.75rem;
  color: #374151;
  text-transform: none;
}
/* Status-Spaltenheader UND -Body-Zelle zentriert. */
.servicebox-list-thead > div:nth-child(6),
.servicebox-list-row   > div:nth-child(6) {
  text-align: center;
}
/* Aktion-Spalte (7. = letzte) — Header zentriert, damit "Aktion" mittig
   über den linksbündigen Icons der Body-Zellen steht. */
.servicebox-list-thead > div:nth-child(7) {
  text-align: center;
}
.servicebox-list-row {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}
/* Richtungs-Tinte — analog zu den Bubble-Farben in der Matrix:
   eingehend = zart rot, ausgehend = zart gelb. */
.servicebox-list-row.direction-in {
  background: #fef2f2;
  border-bottom-color: #fee2e2;
}
.servicebox-list-row.direction-out {
  background: #fefce8;        /* zarter als das vorige #fef9c3 */
  border-bottom-color: #fef3c7;
}
.servicebox-list-sdg {
  font-family: ui-monospace, monospace;
  color: #2563eb;
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.servicebox-list-sdg-marker {
  color: #dc2626;
  margin-right: 0.125rem;
}
.servicebox-list-row-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.servicebox-list-row-status.status-neu     { background: #dc2626; color: #ffffff; }
.servicebox-list-row-status.status-progress { background: #fbbf24; color: #1f2937; }
.servicebox-list-row-status.status-closed  { background: #9ca3af; color: #ffffff; }
/* Abgeschlossene Zeile — desaturiert, leicht ausgegraut. Zeile selbst
   wird optisch dezenter, damit aktive Anfragen Priorität haben. */
.servicebox-panel-list-row.is-closed,
.servicebox-list-row.is-closed {
  filter: saturate(0.6);
  opacity: 0.78;
}
.servicebox-list-actions {
  display: inline-flex;
  gap: 0.125rem;
  /* Refine: rechtsbündig — Mail-Tooltip sitzt am Ende und damit ganz
     rechts in der Aktion-Spalte (passive Info, selten gebraucht).
     Aktive Aktion-Icons direkt davor. */
  justify-content: flex-end;
  align-items: center;
}
.servicebox-list-action-placeholder {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid #86efac;
  border-radius: 0.25rem;
  background: #ffffff;
}
/* Aktion-Icons (Lucide-Style) — kleine Buttons mit SVG-Icon, hover
   ändert den Hintergrund. Mail-Tooltip-Span ist passiv (kein Button),
   nur ein Cursor-Help fürs Hover. */
.servicebox-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  color: #15803d;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.servicebox-action-icon:hover {
  background: #ffffff;
  border-color: #86efac;
}
.servicebox-action-icon:focus-visible {
  outline: 2px solid #15803d;
  outline-offset: 1px;
}
.servicebox-action-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: #6b7280;
  cursor: help;
  white-space: pre-line;     /* aria-label/title respektieren \n */
}
.servicebox-action-info:hover { color: #15803d; }

/* Chronologie unter jeder Datenzeile.
   Grid-Spalten: Date-Spalte exakt so breit wie die Sendungsnummer-Spalte
   plus deren Gap (13rem + 0.5rem = 13.5rem). Damit beginnt die Text-
   Spalte genau unter der "Anfragetyp"-Header-Spalte (linksbündige
   Ausrichtung Name → Header).
   Lesbarkeit: zebra-Streifen, etwas mehr vertikales Padding, dunklerer
   Text, schmaler vertikaler Separator zwischen Date- und Text-Spalte. */
.servicebox-list-chrono {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.8125rem;
  color: #1f2937;
  line-height: 1.4;
}
/* Zebra-Streifen in der Chronologie — Klassen werden vom JS alternierend
   pro Eintrag innerhalb einer Anfrage vergeben (chrono-even/chrono-odd).
   nth-of-type funktioniert hier nicht, weil zwischen den Chrono-Rows immer
   die `.servicebox-list-row` der nächsten Anfrage sitzt. */
.servicebox-list-chrono.chrono-even { background: #ffffff; }
.servicebox-list-chrono.chrono-odd  { background: #f9fafb; }
/* Letzter Chrono-Eintrag vor der nächsten Datenzeile: kein eigener Border
   (die nachfolgende `.servicebox-list-row` bringt einen 1px-Rahmen mit). */
.servicebox-list-chrono + .servicebox-list-row { margin-top: 0; }
.servicebox-list-chrono-date {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
  padding-right: 0.5rem;
  white-space: nowrap;
}
.servicebox-list-chrono-text {
  padding-left: 0.25rem;
}
.servicebox-list-chrono-text.is-system {
  font-style: italic;
  color: #9ca3af;
}
/* Mehr Luft zwischen "Name" und "Text" — der Em-Dash sitzt mittig in
   einem eigenen Span mit links/rechts margin. */
.servicebox-list-chrono-name {
  font-weight: 600;
  color: #111827;
}
.servicebox-list-chrono-sep {
  display: inline-block;
  margin: 0 0.625rem;
  color: #9ca3af;
}

/* Modal-Breite: Matrix bleibt 28rem schmal; sobald die Liste sichtbar wird,
   bekommt das Modal-Card eine größere max-width (64rem reicht für die
   13rem SSCC-Spalte + Anfragetyp + Erstellt + Von/An + 1fr Name + 7.5rem
   Status + 4rem Aktion plus Gaps). JS togglt `list-mode` auf dem
   äußeren `.servicebox-modal`-Element. */
.servicebox-modal.list-mode .servicebox-modal-card {
  max-width: 64rem;
}

/* 6. Panel scaffold + sub-view visibility.
 * `.servicebox-panel` has NO `display:*` — only `.servicebox-panel.flex`.
 * `.servicebox-panel-sub` defaults to `display:none` so every sub-view
 * starts hidden; Alpine adds `.flex` to whichever sub-view is active. */
.servicebox-panel {
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}
.servicebox-panel-sub { display: none; }
.servicebox-panel-sub.flex {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* 7. Servicebox-Panel als Grid-Item in §2 .auftrag-grid.
 *
 * Konzept (User-Refinement, weicht von Spec §4.2 ab):
 *   - Kopfzeile + §3-§7 bleiben unverändert in voller Breite sichtbar.
 *   - In §2 verstecken sich bei panel-open die Spalten 3 (Status der Sendung)
 *     und 4 (Quittungsleistung) via `.sendung-col-collapsible { display:none }`.
 *   - Das Panel sitzt ALS GRID-ITEM in .auftrag-grid und nimmt mit
 *     `grid-column: 3 / span 2` exakt deren Plätze ein.
 *   - Versender (Col 1) + Empfänger (Col 2) behalten ihre Original-Breite
 *     (1fr von 4) — sie schrumpfen nicht.
 *   - Panel hat eine `max-height` und internen Scroll, damit längere
 *     Kommunikation nicht den Rest der Seite nach unten drückt. */
.sendung-page.panel-open .sendung-col-collapsible { display: none; }

@media (min-width: 1024px) {
  /* Panel als Grid-Item — übernimmt die Plätze der versteckten Col 3+4.
     Stil analog zu .auftrag-col (Border, Radius, Page-BG, padding 0,
     flex-column) damit es visuell als 3.+4. „Spalte" durchgeht. */
  .sendung-page.panel-open #servicebox-panel {
    grid-column: 3 / span 2;
    grid-row: 1;
    background: var(--color-page-bg);
    border: 1px solid var(--dtl-line-soft);
    border-radius: 0.375rem;
    padding: 0;
    overflow: hidden;
    /* Höhe: max ~Auftrag-Col-Höhe; bei mehr Content scrollt der Body. */
    max-height: 28rem;
    display: flex;
    flex-direction: column;
  }
  /* Header (`.auftrag-col-title`) bleibt sticky oben, Body scrollt. */
  .sendung-page.panel-open #servicebox-panel > .auftrag-col-title {
    flex-shrink: 0;
  }
  .sendung-page.panel-open #servicebox-panel > .servicebox-panel-sub.flex {
    flex: 1;
    overflow-y: auto;
    padding: 0;
  }
}

/* Panel-Header (auftrag-col-title-Style) — der zusätzliche Modifier
   `.servicebox-panel-title` fügt nur eine kleine Hover-Sektion am
   Close-Button hinzu; Layout ist sonst identisch zum Auftrag-Col-Titel. */
.servicebox-panel-title {
  justify-content: space-between;
}

/* Detail-View Header — sieht aus wie .auftrag-col-title (grauer Streifen
   mit border-bottom), plus Zurück-Pfeil links und Icon-Toolbar rechts. */
.servicebox-detail-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.servicebox-detail-back {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  color: #15803d;
  padding: 0 0.25rem;
  line-height: 1;
}
.servicebox-detail-back:hover { color: #166534; }
.servicebox-detail-title {
  font-weight: 700;
  color: #111827;
}
.servicebox-detail-actions {
  display: inline-flex;
  gap: 0.125rem;
  align-items: center;
  margin-left: auto;
}
.servicebox-detail-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  padding: 0.4rem 0.625rem 0.5rem;
  margin: 0;
  border-bottom: 1px solid #f3f4f6;
}

/* Reply-Form — kompakter, SB-Look (keine btn-primary mit großem Padding
   und vollem grünen Block; stattdessen schlanke Pill-Buttons). */
.servicebox-reply-form {
  padding: 0.625rem 0.75rem 0.75rem;
}
.servicebox-reply-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #374151;
  margin-bottom: 0.25rem;
}
.servicebox-reply-textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  background: #ffffff;
  resize: vertical;
  min-height: 4rem;
}
.servicebox-reply-textarea:focus {
  outline: 2px solid #86efac;
  outline-offset: -1px;
  border-color: #15803d;
}
.servicebox-reply-actions {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.servicebox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}
.servicebox-btn-primary {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
}
.servicebox-btn-primary:hover { background: #166534; border-color: #166534; }
.servicebox-btn-secondary {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}
.servicebox-btn-secondary:hover { background: #f3f4f6; }

/* Panel-Liste — kompaktes Tabellen-Layout ohne Sendungsnummer-Spalte
   (User refine: wir sind ja schon auf der Sendung). 6 Spalten:
   Erstellt | Anfragetyp | Von/An | Name | Status | Aktion. */
.servicebox-panel-list {
  /* KEIN baseline `display:block` — würde das `hidden`-Attribut
     überschreiben (Visibility-Toggle-Trap aus visibility-toggles.md).
     Divs sind ohnehin block by default; nur den Font setzen. */
  font-size: 0.8125rem;
}
.servicebox-panel-list-thead,
.servicebox-panel-list-row {
  display: grid;
  /* Aktion-Spalte 3rem → 5rem, damit bis zu 3 Aktions-Icons + Mail-
     Tooltip rein passen. Name (1fr) absorbiert die Differenz. */
  grid-template-columns: 6.5rem 6.5rem 4.5rem 1fr 6rem 5rem;
  gap: 0.375rem;
  padding: 0.4rem 0.625rem;
  align-items: center;
}
.servicebox-panel-list-thead {
  border-bottom: 1px solid var(--dtl-line);
  font-weight: 600;
  font-size: 0.6875rem;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: #f3f4f6;
}
.servicebox-panel-list-thead > div:nth-child(5),
.servicebox-panel-list-row   > div:nth-child(5) {
  text-align: center;
}
/* Aktion-Spalten-Header (6. = letzte) zentriert. */
.servicebox-panel-list-thead > div:nth-child(6) {
  text-align: center;
}

/* Neue-Anfrage-CTA — scoped Flex-Toggle, damit das `hidden`-Attribut
   im statischen Markup greift (kein baseline-`display:flex`). */
.servicebox-add-new-row {
  margin-top: 0.75rem;
  justify-content: flex-end;
}
.servicebox-add-new-row:not([hidden]) {
  display: flex;
}
.servicebox-panel-list-row {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}
.servicebox-panel-list-row.direction-in {
  background: #fef2f2;
  border-bottom-color: #fee2e2;
}
.servicebox-panel-list-row.direction-out {
  background: #fefce8;
  border-bottom-color: #fef3c7;
}
.servicebox-panel-list-row:hover { filter: brightness(0.97); }
.servicebox-panel-list-actions {
  display: inline-flex;
  gap: 0.25rem;
  /* Refine: rechtsbündig — Mail-Tooltip (passive Info) sitzt am rechten
     Rand, aktive Aktion-Icons direkt davor. */
  justify-content: flex-end;
}
/* Refine: das Status-Badge im Panel-Kontext ist enger gepadded und nutzt
   eine kleinere Font, damit "IN BEARBEITUNG" in die 6rem-Status-Spalte
   passt (im Übersichts-Modus ist die Spalte 7.5rem breit, da reicht das
   Standard-Padding). */
.servicebox-panel-list-row .servicebox-list-row-status {
  font-size: 0.625rem;
  padding: 0.2rem 0.45rem;
  letter-spacing: 0.01em;
}

/* Panel-Chronologie unter jeder Anfrage — same look as SB-Übersicht-
   Chronologie, aber kompakter weil im Panel weniger Platz. */
.servicebox-panel-chrono {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.375rem;
  padding: 0.3rem 0.625rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.75rem;
  color: #1f2937;
  line-height: 1.4;
}
.servicebox-panel-chrono.chrono-even { background: #ffffff; }
.servicebox-panel-chrono.chrono-odd  { background: #f9fafb; }
.servicebox-panel-chrono-date {
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
  padding-right: 0.4rem;
  white-space: nowrap;
}
.servicebox-panel-chrono-text {
  padding-left: 0.2rem;
}
.servicebox-panel-chrono-text.is-system {
  font-style: italic;
  color: #9ca3af;
}
.servicebox-panel-chrono-name {
  font-weight: 600;
  color: #111827;
}
.servicebox-panel-chrono-sep {
  display: inline-block;
  margin: 0 0.5rem;
  color: #9ca3af;
}

/* Inline-Reply (Antworten / Erinnern direkt in der Liste).
   Verwendet das gleiche Chrono-Row-Layout. Der Hintergrund folgt der
   Richtung der Parent-Anfrage (rosa für eingehend, gelb für ausgehend)
   damit der Reply visuell zum Anfrage-Block gehört. Darunter eine Row
   mit Senden / Abbrechen mit identischer Tinte. */
.servicebox-panel-chrono-reply.direction-in,
.servicebox-reply-actions-inline.direction-in {
  background: #fef2f2;
}
.servicebox-panel-chrono-reply.direction-out,
.servicebox-reply-actions-inline.direction-out {
  background: #fefce8;
}
.servicebox-reply-inline-textarea {
  width: 100%;
  border: 1px dashed #d1d5db;
  border-radius: 0.25rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.8125rem;
  font-family: inherit;
  background: #ffffff;
  resize: vertical;
  min-height: 2.5rem;
}
.servicebox-reply-inline-textarea:focus {
  outline: none;
  border-color: #15803d;
  border-style: solid;
}
.servicebox-reply-actions-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.625rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}
.servicebox-reply-actions-inline .form-error {
  flex: 1;
  color: #b91c1c;
  font-size: 0.75rem;
  margin: 0;
}
.servicebox-reply-actions-inline .servicebox-btn {
  margin-left: auto;
}
.servicebox-reply-actions-inline .servicebox-btn + .servicebox-btn {
  margin-left: 0;
}

/* Inline-Schließen — mehrfeldige Form direkt unter der Anfrage-Zeile.
   Tinte folgt der Richtung wie auch Inline-Reply. */
.servicebox-inline-close-intro {
  color: #374151;
  font-style: italic;
}
.servicebox-inline-close-fields {
  padding: 0.4rem 0.75rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}
.servicebox-inline-close-fields.direction-in  { background: #fef2f2; }
.servicebox-inline-close-fields.direction-out { background: #fefce8; }
.servicebox-inline-field {
  margin-top: 0.4rem;
}
.servicebox-inline-field:first-child {
  margin-top: 0;
}
.servicebox-inline-field label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #374151;
  margin-bottom: 0.2rem;
}
.servicebox-inline-field select,
.servicebox-inline-field input[type="text"],
.servicebox-inline-field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.3rem 0.45rem;
  font-size: 0.8125rem;
  font-family: inherit;
  background: #ffffff;
}
.servicebox-inline-field textarea {
  resize: vertical;
  min-height: 3rem;
}
.servicebox-inline-field select:focus,
.servicebox-inline-field input[type="text"]:focus,
.servicebox-inline-field textarea:focus {
  outline: none;
  border-color: #15803d;
}
.servicebox-inline-close-fields .form-error {
  margin-top: 0.4rem;
  color: #b91c1c;
  font-size: 0.75rem;
}

/* Mobile tab toggle: visible only < lg AND panel open. */
.sendung-page .sendung-mobile-tabs { display: none; }
.sendung-page.panel-open .sendung-mobile-tabs { display: flex; }
@media (min-width: 1024px) {
  .sendung-page.panel-open .sendung-mobile-tabs { display: none; }
}

/* 8. Chronology row styles */
.servicebox-chronology {
  list-style: none;
  padding: 0;
  margin: 0;
}
.servicebox-chronology .chronology-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
}
.servicebox-chronology .chronology-row:last-child { border-bottom: 0; }
.chronology-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  margin-top: 0.45rem;
  flex: 0 0 auto;
}
.chronology-dot.dot-blue  { background: #2563eb; }
.chronology-dot.dot-green { background: #16a34a; }
.chronology-bell {
  color: #ca8a04;
  flex: 0 0 auto;
  margin-top: 0.2rem;
  font-size: 1rem;
}
.chronology-meta {
  color: #6b7280;
  font-size: 0.75rem;
}
.chronology-text { white-space: pre-wrap; }
.chronology-system {
  justify-content: center;
  color: #9ca3af;
  font-style: italic;
}

/* 9. New-request form, close popup */
.servicebox-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.servicebox-form .form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}
.servicebox-form .form-field input,
.servicebox-form .form-field select,
.servicebox-form .form-field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.servicebox-form .form-error {
  color: #dc2626;
  font-size: 0.75rem;
}

/* 10. Dev BU-switcher chip (gated by `.dev-only`).
 * The `body[data-environment]` attribute is set by base.html in a
 * sibling ticket (SBX-2.6). This CSS only declares the gating selector;
 * the chip stays invisible everywhere else. */
.dev-only { display: none; }
body[data-environment="dev-local"] .dev-only,
body[data-environment="local"]     .dev-only,
body[data-environment="dev"]       .dev-only { display: inline-flex; }

.bu-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0.5rem;
  font-size: 0.75rem;
}
.bu-switcher label {
  font-weight: 600;
  color: #92400e;
}
.bu-switcher select {
  background: transparent;
  border: 0;
  font-size: 0.75rem;
}

/* 11. Loading skeleton.
   Refine: KEIN baseline `display:flex` — würde das `hidden`-Attribut
   überschreiben (visibility-toggles.md). Skeleton-Bars sind ohnehin
   Block-Elemente; ein simpler vertikaler Stack mit `gap` reicht nicht
   ohne flex/grid, also nutzen wir margin-top auf den Folgegeschwistern. */
.servicebox-loading {
  flex-direction: column;
  padding: 0.75rem;
}
.servicebox-loading .skeleton-bar + .skeleton-bar {
  margin-top: 0.5rem;
}
/* Scoped Display-Toggle — analog zu .servicebox-modal.flex.
   JS kann `.servicebox-loading.flex` togglen, falls explizites
   Flex-Layout gewünscht; aktuell reicht die baseline Block-Darstellung. */
.servicebox-loading.flex {
  display: flex;
}
.servicebox-loading .skeleton-bar {
  height: 0.75rem;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
}
@keyframes skeleton-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* 12. Section header for the wrap section in modal/panel */
.servicebox-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

/* =========================================================================
 * HDB-3.0 — Systemhandbuch: Layout-Basis (Topbar-Suche + 2/3-Spalten-Layout)
 *
 * Mockup-Referenz: documentation/.../attachments/lese-ansicht-mockup.html,
 * Sektion „Hauptlayout (3 Spalten)" und „Topbar (Portal-Standard)".
 *
 * Konvention (siehe HDB-3.0 spec + standards/global/coding-standards):
 *   - Hand-kuratiertes Tailwind-CSS, KEIN Node-Build. Neue Utility-artige
 *     Klassen werden hier eingefügt, NICHT generisch (kein `.grid-3` o.ä.) —
 *     stattdessen komponenten-gescoped mit dem `.handbuch-`-Präfix.
 *   - Visibility-Toggles-Disziplin (visibility-toggles.md): die Klassen
 *     unten setzen `display: grid` etc. NUR auf gescopete Komponenten-
 *     Selektoren. Sie sind sicher, weil sie nicht versehentlich auf andere
 *     Elemente "wandern" können.
 *
 * Komponenten-Vokabular:
 *   .handbuch-topbar           — Handbuch-eigene Topbar mit Such-Form
 *                                (zwischen Portal-Ribbon und dem Layout)
 *   .handbuch-search-form      — die <form> in der Handbuch-Topbar
 *   .handbuch-search-icon      — dekoratives Lupen-Icon im Such-Input
 *   .handbuch-search-input     — das eigentliche <input type="search">
 *   .handbuch-search-submit    — der „Suchen"-Submit-Button (Breite-Hint)
 *   .handbuch-layout           — der 2-/3-Spalten-Grid-Wrapper
 *   .handbuch-nav-col          — linke Spalte (Navigationsbaum, HDB-3.1)
 *   .handbuch-content-col      — mittlere Spalte (Seiteninhalt, HDB-3.3)
 *   .handbuch-aside-col        — rechte Spalte (optional, HDB-4.2 etc.)
 *   .handbuch-page-card        — weißes Panel mit Border + Padding für
 *                                den Inhalts-Container der Lese-Ansicht
 *   .handbuch-doctype-strip    — Doctype-Pille links + Rn./Version rechts
 *   .handbuch-doctype-badge    — die DTL-Grün-Pille mit Doctype-Text
 *   .handbuch-doctype-dot      — winziger Punkt vor dem Badge-Text
 *   .handbuch-doctype-rn       — Monospace-Rn./Version oben rechts
 *   .handbuch-meta-grid        — 2-spaltiges Metadaten-Grid (§4)
 *   .handbuch-meta-row         — eine Zeile = Key + Wert
 *   .handbuch-meta-key         — Label links (gray-500)
 *   .handbuch-meta-val         — Wert rechts (gray-900)
 *   .handbuch-meta-mono        — Monospace-Variante (für Randnummer)
 *   .handbuch-page-title       — großer h1 unter dem Strip/Meta-Grid
 *   .handbuch-edited-by        — „Bearbeitet von <b>Name</b>" als Footer
 *                                des Seitenkopfs (mit Hairline-Trenner)
 *   .handbuch-content          — Container für den `seite.inhalt`-Stream
 *                                (Typografie für Absätze, Tabellen, Bilder)
 *   .handbuch-pdf-stub         — Stub-Hinweis für `seiten_typ='pdf'`
 *                                (HDB-4.3 ersetzt ihn durch echten <embed>)
 *   .handbuch-crossref-active  — Auto-Linkified `Rn. NNNNN` (existiert+aktiv,
 *                                grüne Pille mit Klick-Ziel, HDB-3.4)
 *   .handbuch-crossref-inactive — Auto-Linkified `Rn. NNNNN` (existiert,
 *                                deaktiviert — grau, kein Klick, HDB-3.4)
 *   .handbuch-crossref-missing — Auto-Linkified `Rn. NNNNN` (existiert
 *                                nicht — rot, kein Klick, HDB-3.4)
 *
 * Breakpoint-Strategie (siehe Mockup-Media-Queries):
 *   >= 1100px  3 Spalten   = 320px | 1fr | 280px (aside)
 *              2 Spalten   = 320px | 1fr           (wenn aside leer)
 *      800-1099            2 Spalten = 280px | 1fr (aside immer aus)
 *      < 800px              stacked   nav → content → aside
 *
 * `[data-aside="empty"]`-Hint kommt aus base.html: Jinja prüft per
 * `self.handbuch_aside()` ob der Block etwas rendert. In HDB-3.0 ist
 * der Aside-Block immer leer, also läuft das Layout auf der 2-Spalten-
 * Variante — sobald HDB-4.2 die rechte Spalte füllt, schaltet das Grid
 * automatisch um.
 * ========================================================================= */

/* ---- Handbuch-Topbar (Such-Form über dem Layout) ---- */
.handbuch-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;          /* gray-200 */
  padding: 0.75rem 1.5rem;
}

.handbuch-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 48rem;                           /* ~768px, vgl. Mockup `.topbar-search` */
  margin: 0 auto;
  position: relative;
}

.handbuch-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  color: #9ca3af;                             /* gray-400, matches placeholder */
  transform: translateY(-50%);
  pointer-events: none;
}

/* Der `input.`-Prefix ist Pflicht — Tailwinds Global-Input-Reset
   (`input { ... }`) hat sonst höhere Spezifität als eine reine Klasse,
   und das left-padding wird unter dem Icon weggefressen. Gleiche Falle wie
   beim Sendung-Topbar-Search (vgl. Kommentar oberhalb `input.topbar-search-input`). */
input.handbuch-search-input {
  flex: 1;
  width: 100%;
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;    /* pl-9 für Platz unter dem Icon */
  background-color: #ffffff;
  border: 1px solid #d1d5db;                  /* gray-300 */
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #111827;                             /* gray-900 */
}
input.handbuch-search-input::placeholder {
  color: #9ca3af;                             /* gray-400 */
}
input.handbuch-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.handbuch-search-submit {
  /* btn-primary übernimmt Farbe + Padding + Hover. Hier nur ein
     Breiten-Hint, damit der Button nicht auf eine einzige Buchstaben-
     Breite zusammenschrumpft. */
  flex-shrink: 0;
}

/* ---- Hauptlayout (2/3 Spalten) ---- */
.handbuch-layout {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  max-width: 1480px;
  margin: 0 auto;
  align-items: start;

  /* Default: Mobile-First — stacked. Reihenfolge des DOM wird respektiert
     (nav OBEN, dann content, dann aside). Hamburger-Toggle für die Nav-
     Spalte kommt in HDB-3.7; in HDB-3.0 sehen Mobile-User die volle Nav
     als ersten Block — das ist naiv aber spec-konform. */
  grid-template-columns: 1fr;
}

/* Tablet: 2 Spalten. Aside bleibt unsichtbar (siehe .handbuch-aside-col). */
@media (min-width: 800px) {
  .handbuch-layout {
    grid-template-columns: 280px 1fr;
  }
}

/* Desktop: 3 Spalten WENN aside gefüllt ist, sonst 2 Spalten breiter. */
@media (min-width: 1100px) {
  .handbuch-layout[data-aside="filled"] {
    grid-template-columns: 320px 1fr 280px;
  }
  .handbuch-layout[data-aside="empty"] {
    grid-template-columns: 320px 1fr;
  }
}

/* ---- Linke Spalte: Navigationsbaum-Container ---- */
.handbuch-nav-col {
  background: #ffffff;
  border: 1px solid #e5e7eb;                  /* gray-200 */
  border-radius: 0.5rem;
  padding: 0.75rem;
  /* Mobile: kein sticky, sonst klebt die leere Nav am Viewport-Top und
     verdrängt den Content. Ab Tablet+: sticky-Sidebar wie im Mockup. */
}
@media (min-width: 800px) {
  .handbuch-nav-col {
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }
}

/* ---- Mitte: Inhalt ---- */
.handbuch-content-col {
  /* `min-width: 0` ist entscheidend: ohne dies wird ein Grid-Item mit
     einem langen unzerbrechlichen Wort (z.B. einer langen Randnummer-Liste
     im Mockup) auf seinen Inhalts-Min-Width gestreckt und überschreibt
     das `1fr`-Limit der Spalte. Dann scrollt die ganze Seite horizontal. */
  min-width: 0;
}

/* ---- Rechte Spalte: Aside ---- */
.handbuch-aside-col {
  /* Default: versteckt — wird via Media-Query oben sichtbar geschaltet,
     aber NUR wenn das Grid die Spalte tatsächlich rendert (also bei
     `data-aside="filled"` ab 1100px). Bis dahin ist die Spalte schlicht
     nicht im sichtbaren Grid-Track, also kommt sie auch nicht zur
     Darstellung. Wir hidden sie zusätzlich mit `display: none`, damit
     auch bei Custom-Browser-Stylings nichts durchscheint. */
  display: none;
}
@media (min-width: 1100px) {
  .handbuch-layout[data-aside="filled"] .handbuch-aside-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0.75rem;
  }
}

/* =========================================================================
 * Navigationsbaum (HDB-3.1)
 * -------------------------------------------------------------------------
 * Rekursive aufklappbare Liste in der linken Spalte (`.handbuch-nav-col`).
 * Markup-Vertrag siehe `templates/handbuch/_nav_tree.html`.
 *
 * Visibility-Disziplin (`frontend/visibility-toggles.md`):
 *   * `.handbuch-nav-subtree` hat KEINE eigene `display`-Regel — die
 *     Sichtbarkeit togglet Alpine via `x-show` (setzt inline
 *     `style="display: none"`/entfernt es). Das vermeidet die Klassen-
 *     vs.-Attribut-Spezifitäts-Falle.
 *   * Das Toggle-Caret bleibt im DOM auch bei Blattknoten (für konsistente
 *     Einrückung); via `.handbuch-nav-leaf .handbuch-nav-toggle
 *     { visibility: hidden }` ausgeblendet (nimmt aber den Platz weiterhin
 *     ein, im Mockup §246 dasselbe Muster).
 *
 * Mockup-Anker: `attachments/lese-ansicht-mockup.html` Sektion
 * „Linke Spalte: Navigationsbaum" (Zeilen 202–275). Hex/var-Mappings:
 *   --gray-50  → #f9fafb
 *   --gray-200 → #e5e7eb
 *   --gray-400 → #9ca3af
 *   --gray-500 → #6b7280
 *   --gray-700 → #374151
 *   --gray-800 → #1f2937
 *   --dtl-green-bg (active background) → var(--dtl-green-light) #E6F4EA
 *   --dtl-green (border accent) → var(--color-primary) #2E7D32
 *   --dtl-green-darker (active fg) → #1B5E20 (= var(--color-primary-hover))
 *
 * Alle Selektoren sind unter `.handbuch-nav-tree` gescoped — die Klassen
 * sind eindeutig (`.handbuch-nav-*`-Präfix), also keine Verwechslungs-
 * Gefahr mit generischen Tailwind-Utilities.
 * ========================================================================= */

.handbuch-nav-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;                        /* 13px */
  line-height: 1.35;
}
.handbuch-nav-tree li {
  margin: 0;
  padding: 0;
}

/* Children-Listen (verschachtelte <ul>) — Einrückung + linke Border-Linie
   wie im Mockup. Visibility wird über die `.is-closed`-Status-Klasse
   getrieben (Refine-Run-1 BLOCKER 1; ersetzt Alpine `x-show`):
     `.handbuch-nav-subtree.is-closed { display: none; }`
   Beim Öffnen entfernt `handbuch_nav_tree.js` die Klasse; Browser-
   Default `display: block` für <ul> greift dann ohne Tailwind-
   Spezifitäts-Kollision. KEINE statische display:*-Klasse im Markup
   (Visibility-Toggles-Disziplin). */
.handbuch-nav-subtree {
  list-style: none;
  margin: 0;
  padding-left: 0.875rem;                      /* 14px Mockup */
  border-left: 1px solid #e5e7eb;              /* gray-200 */
}
.handbuch-nav-subtree.is-closed {
  display: none;
}

/* Die Klick-Zone pro Knoten — Caret + Label + ggf. Randnummer.
   Flex-Container für stabile Ausrichtung. */
.handbuch-nav-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: #1f2937;                              /* gray-800 */
  user-select: none;
}
.handbuch-nav-item:hover {
  background: #f9fafb;                         /* gray-50 */
}

/* Toggle-Caret. `is-closed` rotiert ihn um 90°, sodass aus ▾ ein ▸ wird —
   eine einzige Glyph reicht, ein Bild-Wechsel ist unnötig. */
.handbuch-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: #6b7280;                              /* gray-500 */
  cursor: pointer;
  transition: transform 0.12s ease;
}
.handbuch-nav-toggle.is-closed {
  transform: rotate(-90deg);
}
/* Blätter zeigen kein Caret — Platz bleibt aber stehen, sonst springt
   das Layout zwischen Geschwister-Reihen. */
.handbuch-nav-leaf .handbuch-nav-toggle {
  visibility: hidden;
  cursor: default;
}

/* Label: dehnt sich aus, schiebt die Randnummer nach rechts. */
.handbuch-nav-label {
  flex: 1;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  /* Lange Bezeichnungen werden gewrappt — kein horizontaler Scroll. */
  overflow-wrap: anywhere;
}
.handbuch-nav-label:hover {
  text-decoration: underline;
}

/* Gruppen-Knoten (`<span>` statt `<a>`) — Same visual, but explicit
   cursor:pointer da kein nativer Link-Cursor. */
.handbuch-nav-group {
  cursor: pointer;
}

/* Randnummer rechts — Monospace + grau, im Mockup als kleiner Hinweis. */
.handbuch-nav-rn {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.6875rem;                        /* 11px */
  color: #9ca3af;                              /* gray-400 */
  margin-left: auto;
  padding-left: 0.375rem;
  flex-shrink: 0;
}

/* Level-1 (Top-Level-Kapitel) — fett, uppercase, kleiner Tracking-Hinweis
   gemäß Mockup §257. */
.handbuch-nav-level-1 > .handbuch-nav-item > .handbuch-nav-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.6875rem;                        /* 11px */
  letter-spacing: 0.5px;
  color: #374151;                              /* gray-700 */
}

/* Aktive Seite — DTL-Grün-Hintergrund + 3px-Border-Left + Bold.
   Padding-Adjust kompensiert die Border, sodass der Text nicht springt. */
.handbuch-nav-active > .handbuch-nav-item {
  background: var(--dtl-green-light);          /* #E6F4EA */
  color: var(--color-primary-hover);           /* #1B5E20 */
  font-weight: 600;
  border-left: 3px solid var(--color-primary); /* #2E7D32 */
  padding-left: calc(0.5rem - 3px);
}
.handbuch-nav-active > .handbuch-nav-item .handbuch-nav-rn {
  color: var(--color-primary-hover);
}

/* Deaktivierte Knoten — nur für Admin-Reader im DOM. Grau-durchgestrichen
   gemäß Mockup §272 + Spec §6.8. */
.handbuch-nav-deactivated > .handbuch-nav-item .handbuch-nav-label {
  color: #9ca3af;                              /* gray-400 */
  text-decoration: line-through;
}

/* =========================================================================
 * Seitenkopf + Inhalt (HDB-3.3)
 * -------------------------------------------------------------------------
 * Komponenten für die Lese-Ansicht einer einzelnen Handbuch-Seite:
 * Doctype-Strip + 7-Felder-Meta-Grid + Großer Titel + „Bearbeitet von"-
 * Footer + Inhalts-Typografie. Visuelles Vorbild ist `lese-ansicht-mockup.html`
 * Sektion „Seitenkopf" und „Inhalt selber". Farben kommen aus den
 * Portal-Token (`--theme-primary-color`, hard-coded Gray-Töne) — wir
 * mappen sie 1:1 vom Mockup, das DTL-Grün als Pillen-Hintergrund nutzt.
 *
 * Keine display:none-Defaults — der ganze Seitenkopf ist server-rendert
 * und immer sichtbar (siehe `visibility-toggles.md`). Print-spezifische
 * Sichtbarkeit kommt in HDB-3.5.
 * ========================================================================= */

/* ---- Page-Card: weißes Panel um Seitenkopf + Inhalt ---- */
.handbuch-page-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;     /* gray-200 */
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

/* ---- Doctype-Strip: Pille links, Rn./Version rechts ---- */
.handbuch-doctype-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.handbuch-doctype-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  background: #ECFCF1;            /* DTL-Grün-Hintergrund */
  color: #1B5E20;                  /* DTL-Grün-darker */
  border: 1px solid #C8E6C9;       /* DTL-Grün-Linie */
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.handbuch-doctype-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2E7D32;              /* DTL-Grün */
  flex-shrink: 0;
}

.handbuch-doctype-rn {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #6b7280;                   /* gray-500 */
}

.handbuch-doctype-rn b {
  color: #1f2937;                   /* gray-800 */
  font-weight: 700;
}

/* ---- Meta-Grid: 2-spaltige Key/Value-Liste (§4) ---- */
.handbuch-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0;
  font-size: 13px;
}

/* Auf engen Viewports (Mobile / schmale Tablet-Spalten) auf eine Spalte
   fallen lassen — das Mockup tut das implizit über sehr breite Labels
   und engere Maximalbreite. */
@media (max-width: 640px) {
  .handbuch-meta-grid {
    grid-template-columns: 1fr;
  }
}

.handbuch-meta-row {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

.handbuch-meta-key {
  width: 110px;
  flex-shrink: 0;
  color: #6b7280;                   /* gray-500 */
  font-weight: 500;
  margin: 0;
}

.handbuch-meta-val {
  color: #111827;                   /* gray-900 */
  font-weight: 500;
  margin: 0;
  /* Word-break, damit lange Werte (z.B. lange Themen-Bezeichnungen)
     den Grid-Track nicht sprengen. */
  word-break: break-word;
}

.handbuch-meta-mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---- Großer Titel: h1 ---- */
.handbuch-page-title {
  margin: 0 0 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid #e5e7eb; /* gray-200 — HDB-REFINE-5: Hairline-
                                       Abschluss des Kopfes. Vorher trug
                                       die `.handbuch-edited-by`-Zeile
                                       diese Linie; nach Refine-4 wanderte
                                       der Bearbeiter-Hinweis in den Fuß,
                                       wodurch der h1 sein visuelles
                                       Gewicht als „Crown" des Kopfes
                                       verlor. Die Linie macht den Übergang
                                       Kopf → Inhalt wieder eindeutig. */
  font-size: 22px;
  line-height: 1.3;
  color: #111827;                   /* gray-900 */
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ---- „Bearbeitet von" — Footer-Note unter h1 ----
 *
 * HDB-REFINE-4 (2026-05-18): Klasse `.handbuch-edited-by` wird seit
 * dem Refactor nicht mehr im Lese-Template gerendert — die Bearbeiter-
 * Info ist in das neue `.handbuch-edited-by-foot` am Seitenende
 * gewandert. Die Klasse bleibt definiert für a) historische Snapshots
 * in der Versionsdiff-Ansicht, die noch den alten Markup-Stand
 * referenzieren könnten, und b) eine etwaige künftige Druckansicht-
 * Variante, die den Bearbeiter wieder unter dem Titel zeigt. Wenn
 * mittelfristig klar ist, dass kein Konsument mehr existiert, kann
 * der Block gefahrlos entfernt werden. */
.handbuch-edited-by {
  font-size: 12px;
  color: #6b7280;                   /* gray-500 */
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.handbuch-edited-by b {
  color: #374151;                   /* gray-700 */
  font-weight: 600;
}

/* HDB-REFINE-4 — „Bearbeitet von"-Fußnote AM SEITENENDE.
 *
 * Wird von `_seitenkopf.html:fuss(seite)` direkt nach dem Inhalts-Div
 * und vor `_vor_zurueck.vor_zurueck(...)` gerendert. Sitzt visuell
 * zwischen Inhalt und der Hairline der Vor/Zurück-Nav. Bewusst KEIN
 * eigener Border — die border-top der `.handbuch-foot-nav` direkt
 * darunter dient als Trennlinie zum Vor/Zurück-Block. Rechtsbündig,
 * weil es als klassische „Gedruckt von…"-Fußnote gelesen wird.
 *
 * Druckansicht: bleibt sichtbar (kein `@media print`-Override) —
 * Revisionssicherheit erfordert, dass der Bearbeiter-Name auch im
 * Ausdruck steht. */
.handbuch-edited-by-foot {
  margin: 1.5rem 0 0;
  font-size: 12px;
  color: #6b7280;                   /* gray-500 */
  text-align: right;
}

.handbuch-edited-by-foot b {
  color: #374151;                   /* gray-700 */
  font-weight: 600;
}

/* ---- Inhalt-Container — Typografie für den seite.inhalt-Stream ---- */
.handbuch-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: #1f2937;                   /* gray-800 */
}

.handbuch-content p {
  margin: 0 0 0.875rem;
}

.handbuch-content h2 {
  font-size: 17px;
  margin: 1.5rem 0 0.5rem;
  color: #111827;
  font-weight: 700;
}

.handbuch-content h3 {
  font-size: 15px;
  margin: 1.25rem 0 0.5rem;
  color: #111827;
  font-weight: 600;
}

.handbuch-content h4 {
  font-size: 14px;
  margin: 1rem 0 0.375rem;
  color: #111827;
  font-weight: 600;
}

.handbuch-content ul,
.handbuch-content ol {
  margin: 0 0 0.875rem;
  padding-left: 1.5rem;
}

.handbuch-content li {
  margin-bottom: 0.25rem;
}

.handbuch-content a {
  color: #1B5E20;                   /* DTL-Grün-darker */
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.handbuch-content a:hover {
  color: #2E7D32;
}

.handbuch-content blockquote {
  margin: 0 0 0.875rem;
  padding: 0.5rem 0.875rem;
  border-left: 3px solid #e5e7eb;
  color: #4b5563;                   /* gray-600 */
  background: #f9fafb;
}

.handbuch-content code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95em;
  background: #f3f4f6;
  padding: 0.0625rem 0.25rem;
  border-radius: 3px;
}

.handbuch-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 0.875rem;
  font-size: 13.5px;
}

.handbuch-content th,
.handbuch-content td {
  border: 1px solid #e5e7eb;
  padding: 0.375rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.handbuch-content thead th {
  background: #f9fafb;
  font-weight: 600;
  color: #111827;
}

.handbuch-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5rem 0;
}

.handbuch-content figure {
  margin: 0 0 0.875rem;
}

.handbuch-content figcaption {
  font-size: 12px;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* ---- Cross-Reference Auto-Linking (HDB-3.4, §6.10) ----
 *
 * Drei Status-Klassen entsprechend dem Mockup
 * (`attachments/lese-ansicht-mockup.html`, `.rn-ref`-Block, Zeile ~395):
 *
 *   .handbuch-crossref-active    — grüne Pille mit Border (aktive Ziel-Seite)
 *   .handbuch-crossref-inactive  — graue Pille (deaktivierte Ziel-Seite,
 *                                   kein href → kein Klick-Effekt)
 *   .handbuch-crossref-missing   — rote Pille als <span> (Randnummer
 *                                   existiert nicht)
 *
 * Visuelle Basis-Form (inline-Layout, Monospace, kleines Padding) ist
 * für alle drei Status identisch — nur Farben/Cursor unterscheiden sich.
 * Das Markup-Tag ist je nach Status `<a>` (aktiv/inaktiv) oder `<span>`
 * (missing); Selektoren auf der Klasse statt auf dem Element-Tag halten
 * den CSS-Schnitt einheitlich. */
.handbuch-crossref-active,
.handbuch-crossref-inactive,
.handbuch-crossref-missing {
  display: inline-flex;
  align-items: baseline;
  gap: 0.125rem;
  padding: 0 0.25rem;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

/* Aktiv: DTL-Grün-Pille — analog Mockup `.rn-ref` (Standard-State). */
.handbuch-crossref-active {
  background: #ECFCF1;              /* DTL-Grün-bg */
  border-color: #BFE9C9;            /* DTL-Grün-line */
  color: #1E5E22;                   /* DTL-Grün-darker (lesbarer Kontrast) */
}

.handbuch-crossref-active:hover {
  background: #BFE9C9;              /* Hover = border-color für ein
                                       sanfteres Fill, ohne abruptes
                                       Darkening — passt zum
                                       `.content a.rn-ref:hover`-Stil
                                       im Mockup. */
}

/* Inaktiv: grau, kein href → kein Klick. `pointer-events:none` macht
 * den Link non-interaktiv, `cursor:not-allowed` kommuniziert das den
 * Maus-Usern. Mockup-Vorbild: `.rn-ref.deactivated`. */
.handbuch-crossref-inactive {
  background: #f3f4f6;              /* gray-100 */
  border-color: #e5e7eb;            /* gray-200 */
  color: #9ca3af;                   /* gray-400 — bewusst nicht
                                       durchgestrichen: der Status ist
                                       „nicht aktiv", nicht „gelöscht"
                                       (§6.10). */
  pointer-events: none;
  cursor: not-allowed;
}

/* Missing: rot. Render als `<span>`, daher kein Klick-Effekt nötig —
 * `pointer-events:none` halten wir trotzdem, damit Hover-Styles und
 * Cursor-Form gegen versehentliche `<a>`-Verwechslungen robust sind.
 * Mockup-Vorbild: `.rn-ref.missing`. */
.handbuch-crossref-missing {
  background: #fee2e2;              /* red-100 */
  border-color: #fecaca;            /* red-200 */
  color: #b91c1c;                   /* red-700 */
  pointer-events: none;
  cursor: not-allowed;
}


/* ---- Formular-Link Deaktiviert-Marker (HDB-4.5, §6.1 L08 / §6.9) ----
 *
 * Markup (siehe `handbuch/formulare.py` + `templates/handbuch/seite.html`):
 *
 *   <a class="handbuch-formular-deaktiviert"
 *      title="Dieses Formular ist nicht mehr aktiv">
 *     Differenzmeldung
 *   </a>
 *
 * Visuelles Verhalten:
 *   * Grauer Text (gray-400) + `text-decoration: line-through`, damit der
 *     Status „nicht mehr aktiv" sofort lesbar ist — bewusst durchgestrichen
 *     (im Unterschied zu `.handbuch-crossref-inactive`, das laut Spec §6.10
 *     NICHT durchgestrichen ist: dort heißt der Status „nicht aktiv" und
 *     ist visuell näher am DTL-Nav-Pattern; hier signalisiert das
 *     line-through, dass die Datei nicht mehr genutzt werden soll).
 *   * `cursor: not-allowed` kommuniziert Maus-Usern, dass der Link tot ist.
 *   * `pointer-events: none` verhindert den Klick zusätzlich zum
 *     entfernten `href` (Defense-in-Depth — Tastatur-Tab überspringt den
 *     Link ohnehin, weil ohne `href` der Anchor nicht fokussierbar ist).
 *   * Title-Tooltip kommt aus dem `title`-Attribut — Browser zeigen ihn
 *     beim Hover, Screenreader lesen ihn als zugängliche Beschreibung. */
.handbuch-formular-deaktiviert {
  color: #9ca3af;                   /* gray-400 — wie crossref-inactive */
  text-decoration: line-through;
  cursor: not-allowed;
  pointer-events: none;
}


/* ---- PDF-Stub-Hinweis (Legacy-Klasse; HDB-4.3 nutzt sie noch in `_print.html`
 *      für den Download-Hinweis-Block) ---- */
.handbuch-pdf-stub {
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  background: #fef3c7;              /* amber-100 */
  border: 1px solid #fde68a;        /* amber-200 */
  border-radius: 6px;
  color: #78350f;                   /* amber-900 */
  font-size: 13.5px;
}

.handbuch-pdf-stub p {
  margin: 0;
}

.handbuch-pdf-stub code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95em;
  background: rgba(255, 255, 255, 0.5);
  padding: 0 0.25rem;
  border-radius: 3px;
}

/* ===========================================================================
 * HDB-4.3 — PDF-Seitentyp Embed (§6.5)
 *
 * Markup (siehe `templates/handbuch/seite_pdf.html`):
 *   <div class="handbuch-pdf-embed-container">
 *     <object class="handbuch-pdf-embed" …>
 *       <p class="handbuch-pdf-fallback">…<a class="handbuch-pdf-fallback-link" …>…</a>…</p>
 *     </object>
 *     <p class="handbuch-pdf-download-hint">
 *       <a class="handbuch-pdf-download-link" …>…</a>
 *       <span class="handbuch-pdf-download-filename">…</span>
 *     </p>
 *   </div>
 *
 * Höhe: 75vh ist ein guter Default für die typische 2/3-Spalten-
 * Page-Card (Topbar + Ribbon nehmen rund 25vh ein). Mindesthöhe 480px
 * verhindert Embed-Kollaps auf sehr niedrigen Viewports.
 * ========================================================================= */

.handbuch-pdf-embed-container {
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.handbuch-pdf-embed {
  width: 100%;
  height: 75vh;
  min-height: 480px;
  border: 1px solid #d1d5db;        /* gray-300 — passt zur Page-Card-Hairline */
  border-radius: 6px;
  background: #f9fafb;              /* gray-50 — neutraler Hintergrund, falls PDF lädt */
  /* Plugin-Fallback-Markup wird via `<object>` als Block gerendert,
     wenn der Browser kein PDF darstellen kann. Wir geben dem
     Fallback-Inhalt etwas Luft, indem das `<object>` auch im
     Fallback-Fall scrollt — sonst würde Plain-Text-Fallback
     überlaufen. */
  overflow: auto;
}

.handbuch-pdf-fallback {
  margin: 0;
  padding: 1rem;
  color: #374151;                   /* gray-700 */
  font-size: 14px;
  line-height: 1.5;
}

.handbuch-pdf-fallback-link {
  color: #2f6f3f;                   /* DTL-Grün — konsistent mit handbuch-content a */
  text-decoration: underline;
  font-weight: 600;
}

.handbuch-pdf-fallback-link:hover {
  color: #1f5a2e;
}

.handbuch-pdf-download-hint {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: #f3f4f6;              /* gray-100 */
  border: 1px solid #e5e7eb;        /* gray-200 */
  border-radius: 6px;
  font-size: 13.5px;
  color: #374151;                   /* gray-700 */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.handbuch-pdf-download-link {
  color: #2f6f3f;
  text-decoration: underline;
  font-weight: 600;
}

.handbuch-pdf-download-link:hover {
  color: #1f5a2e;
}

.handbuch-pdf-download-filename {
  color: #6b7280;                   /* gray-500 — sekundäre Info */
}

.handbuch-pdf-download-filename code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95em;
  background: #ffffff;
  padding: 0 0.3rem;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
}

/* ===========================================================================
 * HDB-3.2 — Breadcrumb (Lese-Ansicht §6.1 L02)
 *
 * Komponente: `.handbuch-breadcrumb` — Pfad-Anzeige oberhalb der Page-Card
 * mit `›`-Trennern und Hover-Unterstreichung. Mockup-Vorlage:
 * `attachments/lese-ansicht-mockup.html`, `.breadcrumb`-Klasse.
 *
 * Markup (siehe `_breadcrumb.html`):
 *   <nav class="handbuch-breadcrumb" aria-label="Pfad">
 *     <a class="handbuch-breadcrumb-link" href="…">Handbuch</a>
 *     <span class="handbuch-breadcrumb-sep" aria-hidden="true">›</span>
 *     <a class="handbuch-breadcrumb-link" href="…">Aufbauorganisation</a>
 *     <span class="handbuch-breadcrumb-sep" aria-hidden="true">›</span>
 *     <span class="handbuch-breadcrumb-current" aria-current="page">…</span>
 *   </nav>
 * =========================================================================== */
.handbuch-breadcrumb {
  font-size: 12px;
  color: #6b7280;                   /* gray-500 */
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.handbuch-breadcrumb-link {
  color: #4b5563;                   /* gray-600 */
  text-decoration: none;
}

.handbuch-breadcrumb-link:hover {
  color: #2E7D32;                   /* DTL-Grün */
  text-decoration: underline;
}

.handbuch-breadcrumb-sep {
  color: #d1d5db;                   /* gray-300 */
}

.handbuch-breadcrumb-current {
  color: #111827;                   /* gray-900 */
  font-weight: 600;
}

.handbuch-breadcrumb-group {
  color: #4b5563;                   /* gray-600 — wie ein Link, aber ohne
                                       hover-underline, denn der Knoten
                                       ist nicht klickbar (kein Ziel). */
  cursor: default;
}


/* ===========================================================================
 * HDB-3.2 — Vor/Zurück-Cards (Lese-Ansicht §6.1 L04)
 *
 * Zwei Karten unter dem Inhalt, die zur Vorgänger- bzw. Nachfolger-Seite
 * im Pre-Order-Walk des Nav-Baums verlinken. Disabled-Stub für Anfang/Ende
 * des Baums (kein Vorgänger/Nachfolger): `<span>` mit `aria-disabled="true"`.
 *
 * Markup (siehe `_vor_zurueck.html`):
 *   <nav class="handbuch-foot-nav" aria-label="Vor und zurück">
 *     <a class="handbuch-foot-nav-link handbuch-foot-nav-prev" href="…">
 *       <span class="handbuch-foot-nav-label">← Zurück</span>
 *       <span class="handbuch-foot-nav-title">…</span>
 *       <span class="handbuch-foot-nav-rn">Rn. 00012</span>
 *     </a>
 *     <a class="handbuch-foot-nav-link handbuch-foot-nav-next" href="…">…</a>
 *   </nav>
 * =========================================================================== */
.handbuch-foot-nav {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;    /* gray-200 */
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
}

.handbuch-foot-nav-link {
  flex: 1;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0.875rem;
  border: 1px solid #e5e7eb;        /* gray-200 */
  border-radius: 8px;
  text-decoration: none;
  background: #f9fafb;              /* gray-50 */
  transition: border-color 0.12s ease, background 0.12s ease;
}

.handbuch-foot-nav-link:hover {
  border-color: #2E7D32;            /* DTL-Grün */
  background: #ECFCF1;              /* DTL-Grün-bg */
}

.handbuch-foot-nav-next {
  text-align: right;
  align-items: flex-end;
}

.handbuch-foot-nav-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #6b7280;                   /* gray-500 */
  font-weight: 600;
}

.handbuch-foot-nav-title {
  color: #111827;                   /* gray-900 */
  font-weight: 600;
  font-size: 13.5px;
}

.handbuch-foot-nav-rn {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: #6b7280;                   /* gray-500 */
  margin-top: 2px;
}

/* Disabled-Stub: kein Hover-Highlight, gedimmte Schrift, kein Cursor-
   Pointer. Bewusst KEIN `pointer-events: none` auf dem Container —
   ein Screenreader-Nutzer mit `tabindex="-1"` springt den Stub eh
   nicht an, aber Maus-Hover darf das Element noch erkennen (z.B.
   um den Tooltip-Text zu lesen, falls wir später einen ergänzen). */
.handbuch-foot-nav-disabled {
  background: #f9fafb;              /* gray-50 */
  cursor: not-allowed;
}

.handbuch-foot-nav-disabled:hover {
  /* Überschreibt den oben definierten Hover-State — disabled Stubs
     dürfen visuell NICHT als „klickbar" rüberkommen. */
  border-color: #e5e7eb;            /* gray-200, unverändert */
  background: #f9fafb;              /* gray-50, unverändert */
}

.handbuch-foot-nav-muted {
  color: #9ca3af;                   /* gray-400 */
  font-weight: 500;
  font-style: italic;
}

/* ===========================================================================
 * HDB-3.5 — Druckansicht (CSS @media print, Produkt-Spec §6.1 L10)
 *
 * Diese Section greift in zwei Fällen:
 *   1. Der Nutzer öffnet die Lese-Ansicht (z.B. /handbuch/seite/OA_00018)
 *      und drückt Strg+P im Browser. Dann sollen Portal-Chrome-Elemente
 *      (Topbar, Ribbon, Nav-Spalte, Foot-Nav, Such-Formular, Buttons …)
 *      AUS dem Druckergebnis verschwinden — wir markieren sie dafür im
 *      Markup mit `.handbuch-no-print` und blenden sie hier per
 *      `display: none !important;` aus.
 *
 *   2. Der Nutzer öffnet die dedizierte Druck-URL
 *      (`/handbuch/print/<datei_id>`), die das standalone-Template
 *      `_print.html` rendert. Dort gibt es kein Portal-Chrome, also
 *      hat die `.handbuch-no-print`-Regel dort keine Wirkung — sie
 *      schadet aber auch nicht. Das standalone-Template bringt zusätzlich
 *      ein eigenes Inline-Print-CSS (Page-Margins, Typografie) mit, das
 *      hier nicht dupliziert wird.
 *
 * Aktuell ist das Markup-seitige Setzen von `.handbuch-no-print` in
 * `templates/handbuch/base.html` NICHT Teil von HDB-3.5 (Out-of-Scope —
 * die offizielle Druck-Variante ist die dedizierte Druck-URL). Die
 * Klasse steht hier dennoch bereit für nachfolgende Tickets, die sie
 * an Topbar/Ribbon/Nav-Spalte vergeben können — z.B. wenn HDB-3.7
 * (responsives Verhalten / ARIA) den Hamburger-Button mit aufnimmt
 * oder Buttons mit Aktionen, die ohnehin nur online sinnvoll sind.
 *
 * Bewusst minimal — alles Weitere (Detail-Print-Styling, page-breaks,
 * Bild-Skalierung) lebt im standalone-Template als Inline-CSS, damit
 * die Druck-Variante auch ohne `output.css` lesbar bleibt.
 * =========================================================================== */
@media print {
  /* Elemente, die im Druck unsichtbar sein sollen — Portal-Chrome,
     interaktive Buttons, Toolbars, etc. Verwendung: `<header class="topbar
     handbuch-no-print" …>`. `!important`, damit die Regel auch gegen
     spezifischere `display:flex/grid`-Setups gewinnt, die das Markup
     ansonsten hat. */
  .handbuch-no-print {
    display: none !important;
  }
}


/* =========================================================================
 * HDB-3.7 — Responsives Verhalten: Mobile-Hamburger für die Nav-Spalte
 * -------------------------------------------------------------------------
 * Gescopete Visibility-Regeln nach dem Pattern aus
 * `purple/standards/frontend/visibility-toggles.md`:
 *
 *   * `.handbuch-nav-toggle-btn`     — Hamburger-Button, sichtbar nur <sm
 *   * `.handbuch-nav-col.hidden`     — Aside-Override: ab `sm+` wird die
 *                                      `.hidden`-Klasse durch eine
 *                                      KLASSE-ZWEIFACH-Selektor-Regel
 *                                      überschrieben (höhere Spezifität
 *                                      als die generische `.hidden`).
 *
 * Breakpoint-Logik:
 *   <  640 px (mobile):  Aside startet mit `.hidden` (= display: none),
 *                        Hamburger ist sichtbar als Inline-Flex-Block.
 *                        JS togglet `.hidden` weg → Aside wird sichtbar.
 *   >= 640 px (sm+ —     Aside ist immer sichtbar (`.handbuch-nav-col.hidden
 *   tablet/desktop):     { display: block }` gewinnt gegen `.hidden`).
 *                        Hamburger ist via Media-Query `display: none`.
 *                        JS togglet `.hidden` weiter — hat aber keine
 *                        sichtbare Wirkung, weil die Media-Query
 *                        gewinnt.
 *
 * Warum 640 px (sm) und nicht 800 px wie bei `.handbuch-layout`?
 *   Die Layout-Grid-Schwelle (800 px) entscheidet, wann 2 Spalten
 *   gerendert werden. Die Hamburger-Schwelle (640 px) entscheidet,
 *   wann die Nav-Spalte ohne Toggle sichtbar ist. Zwischen 640 und
 *   800 px ist die Nav-Spalte permanent sichtbar UND stacked (weil
 *   `.handbuch-layout` noch 1-spaltig ist) — das ist exakt das
 *   gewünschte Verhalten für kleine Tablets im Portrait-Modus
 *   (Spec HDB-3.7 §Mobile-Threshold).
 *
 * Touch-Target-Disziplin (§AC4 / WCAG 2.5.5):
 *   Der Button hat `min-height: 44px` UND `min-width: 44px`. Nav-Links
 *   im Tree erben das Padding aus `.handbuch-nav-tree`, das schon in
 *   HDB-3.1 großzügig genug für 44 px ist (line-height 1.35 × 13 px +
 *   padding 8 px = ~26 px — wir setzen hier zusätzlich Minimum, damit
 *   auf Mobile garantiert ≥44 px erreicht wird).
 * ========================================================================= */

/* ---- Hamburger-Button: nur <sm sichtbar ---- */
.handbuch-nav-toggle-btn {
  /* Default (mobile): sichtbar als Inline-Flex-Block. Wir nutzen
     hier eine gescopete Komponenten-Klasse, damit kein generisches
     `.flex`/`.inline-flex` aus dem statischen Markup nötig ist
     (visibility-toggles.md: keine Display-Utilities in statischer
     Class-Liste für toggle-relevante Elemente). */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  /* Touch-Target ≥ 44 px (WCAG 2.5.5 / HDB-3.7 §AC4). */
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.875rem;
  background-color: #ffffff;
  border: 1px solid #d1d5db;                  /* gray-300 */
  border-radius: 0.375rem;
  color: #111827;                             /* gray-900 */
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  cursor: pointer;
  /* Eigener Slot im Grid: stacked oben, vor dem Aside. Margin-bottom
     gleich `.handbuch-layout`-Gap, damit die Visualabstands-Reihe
     konsistent bleibt — der Button ist ein Grid-Item, hat aber keine
     eigene Spalte. */
  margin-bottom: 0.25rem;
}
.handbuch-nav-toggle-btn:hover {
  background-color: #f9fafb;                  /* gray-50 */
}
.handbuch-nav-toggle-btn:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.handbuch-nav-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.handbuch-nav-toggle-label {
  /* Sichtbarer Text neben dem Glyph; auf sehr engen Viewports
     trotzdem lesbar — kein `sr-only`-Versteck. */
  font-weight: 600;
}

/* Ab sm (640 px): Button verschwindet — Nav-Spalte ist permanent
   sichtbar (siehe nächster Block), also wäre der Toggle redundant. */
@media (min-width: 640px) {
  .handbuch-nav-toggle-btn {
    display: none;
  }
}

/* ---- Nav-Spalte: ab sm immer sichtbar, .hidden override ---- */
/* Doppel-Klassen-Selektor: `.handbuch-nav-col.hidden` hat Spezifität
   (0,2,0) und gewinnt gegen `.hidden` (0,1,0). Damit überschreiben
   wir die `.hidden`-Klasse aus dem statischen Markup OHNE
   !important — sauber gescoped, betrifft nur diese eine Komponente.
   Visibility-Toggles-Disziplin: kein generisches `.block`-Override,
   keine Klasse die versehentlich auf andere Elemente "wandern" kann.

   Ohne Klasse `.hidden` (z.B. nachdem User auf Mobile den Hamburger
   gedrückt hat und dann das Browser-Fenster auf Desktop-Breite
   vergrößert) ist `.handbuch-nav-col` ohnehin ein `<aside>`-Element,
   das per User-Agent-Stylesheet `display: block` ist — kein
   zusätzliches Override nötig. */
@media (min-width: 640px) {
  .handbuch-nav-col.hidden {
    display: block;
  }
}

/* ---- Nav-Links: Touch-Target ≥ 44 px auf Mobile ---- */
/* Die `.handbuch-nav-item` ist die klickbare Reihe im Nav-Tree
   (siehe HDB-3.1). Auf Mobile vergrößern wir die Click-Area
   per `min-height: 44px`; auf Desktop bleibt das kompakte Layout
   aus HDB-3.1 erhalten (die Min-Height greift dort nicht
   regressiv — sie ist nur ein Minimum, der natürliche Inhalt
   ist auf Desktop bereits passend hoch). */
@media (max-width: 639px) {
  .handbuch-nav-tree .handbuch-nav-item {
    min-height: 44px;
    /* Vertikale Zentrierung via flex; `.handbuch-nav-item` ist
       laut HDB-3.1-Markup ein Block — wir machen ihn auf Mobile
       zum Flex-Container. KEIN globales `.flex`-Utility, sondern
       gescoped auf die `.handbuch-nav-item` innerhalb des Trees.
       Damit bleibt die Visibility-Toggles-Disziplin gewahrt. */
    display: flex;
    align-items: center;
  }
}

/* ===========================================================================
 * HDB-4.2 — Volltextsuche-Trefferliste + Pagination
 * ---------------------------------------------------------------------------
 * Komponenten:
 *   .handbuch-suche                  — Wrapper-Section auf /handbuch/suche
 *   .handbuch-suche-header           — Kopfbereich mit Titel + Status
 *   .handbuch-suche-title            — H1 „Volltextsuche"
 *   .handbuch-suche-status           — Status-Zeile („N Treffer für …" /
 *                                       „Keine Treffer für …")
 *   .handbuch-suche-status-empty     — Modifier für Empty-State (etwas
 *                                       sekundärere Farbe)
 *   .handbuch-suche-query            — Monospace-Anzeige des Suchbegriffs
 *                                       im Status (entspricht der `code`-
 *                                       Optik im Mockup)
 *   .handbuch-suche-hits             — `<ol>`-Liste der Treffer
 *   .handbuch-suche-hit              — einzelne Treffer-Card (Mockup-
 *                                       Anker: weiß, gray-200 Border,
 *                                       0.5rem Padding)
 *   .handbuch-suche-hit-link         — Anchor, der den ganzen Treffer
 *                                       klickbar macht (Touch-Target!)
 *   .handbuch-suche-hit-headrow      — Flex-Row: Titel links, Rn. rechts
 *   .handbuch-suche-hit-title        — Überschrift mit `<mark>`-Highlight
 *                                       (font-weight 600, gray-900)
 *   .handbuch-suche-hit-rn           — Rn. inline, monospace, gray-400
 *   .handbuch-suche-hit-metarow      — Dokumenttyp-Badge-Zeile unter dem
 *                                       Titel
 *   .handbuch-suche-hit-badge        — Doctype-Badge (Pille, gray-100)
 *   .handbuch-suche-hit-snippet      — Snippet-Absatz mit gray-600 Text
 *                                       und `mark { background: #fef08a }`
 *   .handbuch-suche-empty            — Empty-State-Box (keine Treffer /
 *                                       leere Query)
 *   .handbuch-suche-empty-tip        — Erläuterungs-Text im Empty-State
 *   .handbuch-suche-empty-links      — `<ul>` mit Links zu A-Z + Inhalt
 *   .handbuch-suche-empty-link       — DTL-Grün-Link
 *   .handbuch-pagination             — Footer-Nav mit Vor/Zurück/Status
 *   .handbuch-pagination-link        — Vor/Zurück-Anker (oder span beim
 *                                       Disabled-State)
 *   .handbuch-pagination-disabled    — Modifier für deaktivierte Links
 *                                       (erste/letzte Seite)
 *   .handbuch-pagination-status      — „Seite X von Y" zentriert
 *
 * Visibility-Toggles-Disziplin: keine generischen `.hidden`-Overrides,
 * keine `display: none`-Tricks — die Trefferliste ist statisch
 * server-gerendert, alles sichtbar.
 * ===========================================================================
 */

.handbuch-suche {
  /* Container für die ganze Suche-Seite. Padding kommt vom Parent
     (`.handbuch-content-col`), daher hier nur Spacing zwischen den
     einzelnen Sub-Sektionen. */
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.handbuch-suche-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;     /* gray-200 — leichter Separator */
}

.handbuch-suche-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111827;                       /* gray-900 */
  line-height: 1.2;
}

.handbuch-suche-status {
  margin: 0;
  font-size: 14px;
  color: #374151;                       /* gray-700 */
  line-height: 1.45;
}

.handbuch-suche-status-empty {
  color: #6b7280;                       /* gray-500 — sekundärer Ton */
}

.handbuch-suche-query {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f3f4f6;                  /* gray-100 */
  color: #111827;                       /* gray-900 */
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

/* ---- Trefferliste ---- */

.handbuch-suche-hits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.handbuch-suche-hit {
  background: #ffffff;
  border: 1px solid #e5e7eb;            /* gray-200 — Mockup-Anker */
  border-radius: 6px;
  padding: 0;                            /* Padding sitzt im Link, damit
                                            er die volle Card klickbar
                                            macht (Touch-Target). */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.handbuch-suche-hit:hover {
  border-color: #2f6f3f;                /* DTL-Grün — passend zu Nav-Hover */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.handbuch-suche-hit-link {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;              /* Mockup-Anker: 0.5rem */
  text-decoration: none;
  color: inherit;
}

.handbuch-suche-hit-link:hover,
.handbuch-suche-hit-link:focus {
  text-decoration: none;
  /* Wir overriden bewusst KEINE Color hier — die Sub-Components haben
     eigene Farben (Title gray-900, Snippet gray-600, Badge eigen). */
}

.handbuch-suche-hit-link:focus-visible {
  outline: 2px solid #2f6f3f;           /* DTL-Grün */
  outline-offset: -2px;
  border-radius: 6px;
}

.handbuch-suche-hit-headrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.handbuch-suche-hit-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;                       /* gray-900 */
  line-height: 1.3;
  flex: 1 1 auto;
  min-width: 0;                          /* erlaubt Text-Truncation in
                                            Flex-Kontext, falls künftig
                                            nötig — Stand HDB-4.2 wird
                                            der Titel umgebrochen. */
}

.handbuch-suche-hit-title mark {
  background: #fef08a;                  /* yellow-200 — Highlight */
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.handbuch-suche-hit-rn {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #9ca3af;                       /* gray-400 — Mockup-Anker */
  white-space: nowrap;
  /* `Rn. NNNNN` darf nicht umgebrochen werden (5-Stellen-Format). */
}

.handbuch-suche-hit-metarow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.handbuch-suche-hit-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f3f4f6;                  /* gray-100 */
  color: #374151;                       /* gray-700 */
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;            /* gray-200 */
}

.handbuch-suche-hit-snippet {
  margin: 0;
  font-size: 13.5px;
  color: #4b5563;                       /* gray-600 — Mockup-Anker */
  line-height: 1.45;
}

.handbuch-suche-hit-snippet mark {
  background: #fef08a;                  /* yellow-200 — Hit-Highlight */
  color: #111827;                       /* gray-900 — Kontrast auf Gelb */
  padding: 0 1px;
  border-radius: 2px;
}

/* ---- Empty-State ---- */

.handbuch-suche-empty {
  background: #f9fafb;                  /* gray-50 — subtile Box */
  border: 1px dashed #d1d5db;           /* gray-300 — dashed signalisiert
                                            „kein Inhalt" */
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.handbuch-suche-empty-tip {
  margin: 0;
  font-size: 14px;
  color: #4b5563;                       /* gray-600 */
  line-height: 1.5;
}

.handbuch-suche-empty-links {
  list-style: disc;
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.handbuch-suche-empty-links li {
  font-size: 14px;
  color: #374151;                       /* gray-700 */
}

.handbuch-suche-empty-link {
  color: #2f6f3f;                       /* DTL-Grün — konsistent mit
                                            .handbuch-content a */
  text-decoration: underline;
  font-weight: 500;
}

.handbuch-suche-empty-link:hover {
  color: #1f5a2e;
}

/* ---- Pagination-Footer ---- */

.handbuch-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid #e5e7eb;        /* gray-200 — Separator zur
                                            Trefferliste */
  flex-wrap: wrap;
}

.handbuch-pagination-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 13.5px;
  font-weight: 500;
  color: #2f6f3f;                       /* DTL-Grün */
  text-decoration: none;
  border: 1px solid #e5e7eb;            /* gray-200 */
  border-radius: 6px;
  background: #ffffff;
  transition: background 0.15s ease, border-color 0.15s ease,
              color 0.15s ease;
}

.handbuch-pagination-link:hover {
  background: #f3f4f6;                  /* gray-100 */
  border-color: #2f6f3f;
  color: #1f5a2e;
  text-decoration: none;
}

.handbuch-pagination-link:focus-visible {
  outline: 2px solid #2f6f3f;
  outline-offset: 2px;
}

.handbuch-pagination-disabled {
  color: #9ca3af;                       /* gray-400 — visuell deaktiviert */
  background: #f9fafb;                  /* gray-50 */
  border-color: #e5e7eb;
  cursor: not-allowed;
  pointer-events: none;
  /* `pointer-events: none` greift nur, weil der Renderer beim
     disabled-State ein `<span>` rendert (kein `<a>`). Ein
     `aria-disabled`-Anchor wäre noch tastatur-fokussierbar — der
     Span vermeidet das. */
}

.handbuch-pagination-status {
  font-size: 13.5px;
  color: #374151;                       /* gray-700 */
  font-weight: 500;
  white-space: nowrap;
}

/* =========================================================================
 * HDB-4.1 — A-Z Index (`/handbuch/index/a-z`).
 *
 * Mockup-Referenz: `attachments/lese-ansicht-mockup.html` → Side-Card
 * „A-Z Quick-Picker". Wir hosten den Quick-Picker als horizontale Strip
 * oben in der Content-Spalte (statt im Side-Panel), weil der A-Z-Index
 * eine eigene Seite ist — dort dient die Strip als Sprung-Navigation
 * ZU den darunter folgenden Buchstaben-Sektionen.
 *
 * Klassen:
 *   .handbuch-az                       — Wrapper-Section auf /handbuch/index/a-z
 *   .handbuch-az-header                — Kopfbereich mit Titel + Status
 *   .handbuch-az-title                 — H1 „A-Z Index"
 *   .handbuch-az-status                — Status-Zeile („N Seiten — alphabetisch …")
 *   .handbuch-az-quickpicker           — Strip-Container (grid mit 10 Spalten)
 *   .handbuch-az-quickpicker-letter    — Einzelne Strip-Kachel (a oder span)
 *   .handbuch-az-quickpicker-disabled  — Modifier für Buchstaben ohne Treffer
 *   .handbuch-az-sections              — Container aller Buchstaben-Sektionen
 *   .handbuch-az-section               — Eine Buchstaben-Sektion (H2 + Liste)
 *   .handbuch-az-letter-heading        — H2 mit Sprung-Anker id="letter-x"
 *   .handbuch-az-list                  — UL der Einträge in der Sektion
 *   .handbuch-az-entry                 — LI eines Eintrags
 *   .handbuch-az-entry-link            — Anchor, der den ganzen Eintrag
 *                                        klickbar macht (flex-row).
 *   .handbuch-az-entry-title           — Titel-Span (Überschrift)
 *   .handbuch-az-entry-rn              — Randnummer rechts, monospace
 *   .handbuch-az-empty                 — Empty-State (keine aktiven Seiten)
 *
 * Visibility-Toggles-Disziplin: alle Komponenten sind statisch sichtbar
 * — keine JS-getriggerten States, keine `.hidden`-Klassen.
 * ========================================================================= */

.handbuch-az {
  /* Eigenständige Card-artige Sektion, analog zur Suche-Trefferliste.
     Keine Background-Farbe — wir liegen direkt im Content-Col-Wrapper,
     dessen Hintergrund schon gesetzt ist. */
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.handbuch-az-header {
  border-bottom: 1px solid #e5e7eb;     /* gray-200 */
  padding-bottom: 0.75rem;
}

.handbuch-az-title {
  font-size: 22px;
  font-weight: 600;
  color: #111827;                       /* gray-900 */
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.handbuch-az-status {
  font-size: 13.5px;
  color: #6b7280;                       /* gray-500 */
  margin: 0;
}

.handbuch-az-quickpicker {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  padding: 0.75rem;
  background: #f9fafb;                  /* gray-50 */
  border: 1px solid #e5e7eb;            /* gray-200 */
  border-radius: 6px;
}

.handbuch-az-quickpicker-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;                         /* Touch-Target ≥ 32 — Desktop ok */
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #374151;                       /* gray-700 */
  background: #ffffff;
  border: 1px solid #e5e7eb;            /* gray-200 */
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease,
              border-color 0.15s ease;
}

.handbuch-az-quickpicker-letter:hover {
  background: #ecfdf5;                  /* dtl-green-bg */
  color: #1f5a2e;                       /* dtl-green-darker */
  border-color: #2f6f3f;
  text-decoration: none;
}

.handbuch-az-quickpicker-letter:focus-visible {
  outline: 2px solid #2f6f3f;
  outline-offset: 2px;
}

.handbuch-az-quickpicker-disabled {
  color: #d1d5db;                       /* gray-300 — visuell deaktiviert */
  background: #f9fafb;                  /* gray-50, leicht abgesetzt */
  border-color: #f3f4f6;                /* gray-100 */
  /* Pointer-events steuert das Tag selbst (span statt a) — kein
     `pointer-events: none` nötig. Span ist nicht tabbable, also auch
     kein Tastatur-Focus auf disabled Letter. */
}

.handbuch-az-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.handbuch-az-section {
  /* Jede Sektion ist eigene visuelle Einheit — leichter Trenner zur
     nächsten via gap im Container. */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.handbuch-az-letter-heading {
  font-size: 20px;
  font-weight: 700;
  color: #1f5a2e;                       /* dtl-green-darker — Sektion-Akzent */
  margin: 0;
  padding: 0.25rem 0;
  border-bottom: 2px solid #2f6f3f;     /* dtl-green */
  /* `scroll-margin-top` sichert, dass der Sprung via #anchor das H2
     nicht direkt am Browser-Viewport-Oberkant klebt — über der
     Topbar bleibt etwas Luft. Wert lehnt sich an die Portal-Topbar-
     Höhe (~64px) plus Handbuch-Topbar (~56px) ≈ 120px. */
  scroll-margin-top: 120px;
}

.handbuch-az-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.handbuch-az-entry {
  /* Kein eigener Background — der Hover-Background sitzt am
     Link-Element, damit der gesamte Klick-Bereich konsistent leuchtet. */
}

.handbuch-az-entry-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.625rem;
  border-radius: 4px;
  text-decoration: none;
  color: #374151;                       /* gray-700 */
  transition: background 0.15s ease, color 0.15s ease;
}

.handbuch-az-entry-link:hover {
  background: #f3f4f6;                  /* gray-100 */
  color: #1f5a2e;                       /* dtl-green-darker */
  text-decoration: none;
}

.handbuch-az-entry-link:focus-visible {
  outline: 2px solid #2f6f3f;
  outline-offset: 2px;
  background: #f3f4f6;
}

.handbuch-az-entry-title {
  /* Titel nimmt den verfügbaren Platz, Rn bleibt rechts kompakt. */
  flex: 1 1 auto;
  font-size: 14.5px;
  line-height: 1.4;
}

.handbuch-az-entry-rn {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: #9ca3af;                       /* gray-400 — sekundär */
  white-space: nowrap;
}

.handbuch-az-empty {
  font-size: 14px;
  color: #6b7280;                       /* gray-500 */
  padding: 1rem;
  background: #f9fafb;                  /* gray-50 */
  border: 1px dashed #e5e7eb;           /* gray-200 */
  border-radius: 6px;
  text-align: center;
}

/* Tablet/Mobile: Quick-Picker auf 7 Spalten reduzieren (Mockup-Variante).
   30 Letter / 7 columns = 5 Zeilen — kompakter Footprint auf engen
   Layouts, ohne Touch-Targets unleserlich klein zu drücken. */
@media (max-width: 1099px) {
  .handbuch-az-quickpicker {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .handbuch-az-quickpicker {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .handbuch-az-entry-link {
    /* Mobile: Stack Titel über Rn, sonst presst der gap die Rn zu
       eng an den Titel-Rechts-Rand. */
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
  }
  .handbuch-az-entry-rn {
    font-size: 11.5px;
  }
}

/* =========================================================================
 * HDB-4.4 — Inhaltsverzeichnis-Seite (`/handbuch/inhalt`, L07).
 *
 * Reduziertes Styling — wir nutzen die A-Z-Index-Header-Klassen
 * (`.handbuch-az-header`, `.handbuch-az-title`, `.handbuch-az-status`)
 * für die Kopfzeile und die etablierte `.handbuch-nav-tree`-Struktur
 * für den Baum selbst (force_expanded-Modus). Hier braucht es nur drei
 * kleine Zusatz-Regeln:
 *
 *   .handbuch-inhalt                   — Wrapper-Section auf der Seite
 *                                        (Flex-Spalte mit gap, analog
 *                                        zur `.handbuch-az`-Section).
 *   .handbuch-inhalt-tree-wrap         — Optional erweiterbarer Layout-
 *                                        Wrapper um den Tree. Aktuell
 *                                        nur ein Marker; reserviert für
 *                                        spätere CSS-Columns-Auto-Layout-
 *                                        Experimente, falls die ~865-
 *                                        Knoten-Liste zu lang wirkt.
 *   .handbuch-empty                    — Defensive Empty-State, wenn
 *                                        `nav_tree_root` leer ist (auf
 *                                        leerer DB). Visuell analog zu
 *                                        `.handbuch-az-empty`.
 *
 * Visibility-Toggles-Disziplin: keine display:none-Defaults, kein
 * `.hidden`. Der Tree ist server-side immer rendert; Alpine togglet
 * via `x-show` die internen `<ul>`-Sub-Listen — im force_expanded-
 * Modus startet ALLES offen.
 * ========================================================================= */

.handbuch-inhalt {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.handbuch-inhalt-tree-wrap {
  /* Aktuell rein semantischer Wrapper — keine eigene visuelle Regel.
     Liegt im Markup, damit ein späterer Mockup-Iterationsschritt hier
     mit `column-count: 2` einen Zweispalter draufzieht, ohne das
     Template anfassen zu müssen. Stand HDB-4.4: einspaltig, voller
     Content-Col-Width. */
}

.handbuch-empty {
  font-size: 14px;
  color: #6b7280;                       /* gray-500 */
  padding: 1rem;
  background: #f9fafb;                  /* gray-50 */
  border: 1px dashed #e5e7eb;           /* gray-200 */
  border-radius: 6px;
  text-align: center;
}

/* =========================================================================
 * Handbuch — Save-Pipeline-Hilfsklassen (HDB-5.3)
 *
 * Wird vom Editor (Konflikt-Banner, Validation-Hinweise) und vom Flash-
 * Banner über jeder Handbuch-Seite genutzt. Bewusst minimalistisch
 * gehalten — die Klassen liefern Padding, Farbe, Border und ARIA-Affordance,
 * keine animierten Effekte. Visibility-Disziplin: keine `display:none`-
 * Defaults; die Banner werden ausschließlich serverside-conditional
 * gerendert.
 *
 * Klassen:
 *   .handbuch-flash-region        — Container über `.handbuch-content-col`
 *                                   für die `flash()`-Meldungen.
 *   .handbuch-flash               — Einzelnes Banner (Erfolg/Hinweis).
 *   .handbuch-flash-success       — Grüne Variante (Default: Save erfolgreich).
 *   .handbuch-flash-info          — Neutrale Variante (Reserve).
 *
 *   .handbuch-editor-banner       — Banner über dem Editor-Form (Konflikt/
 *                                   Validation). Status-gefärbt per Sub-
 *                                   Klasse.
 *   .handbuch-editor-banner-konflikt    — Rote Variante (HTTP 409).
 *   .handbuch-editor-banner-validation  — Gelbe Variante (HTTP 400).
 *
 *   .handbuch-editor-input-error  — Rote Umrandung für ungültige Felder.
 *   .handbuch-editor-fielderror   — Kleine rote Hint-Span unter dem Feld.
 * ========================================================================= */

.handbuch-flash-region {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.handbuch-flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid transparent;
}

.handbuch-flash-success {
  background: #ecfdf5;                  /* emerald-50 */
  border-color: #a7f3d0;                /* emerald-200 */
  color: #065f46;                       /* emerald-800 */
}

.handbuch-flash-info {
  background: #eff6ff;                  /* blue-50 */
  border-color: #bfdbfe;                /* blue-200 */
  color: #1e40af;                       /* blue-800 */
}

.handbuch-editor-banner {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 1.25rem;
}

.handbuch-editor-banner-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.handbuch-editor-banner-konflikt {
  background: #fef2f2;                  /* red-50 */
  border-color: #fecaca;                /* red-200 */
  color: #991b1b;                       /* red-800 */
}

.handbuch-editor-banner-validation {
  background: #fffbeb;                  /* amber-50 */
  border-color: #fde68a;                /* amber-200 */
  color: #92400e;                       /* amber-800 */
}

.handbuch-editor-input-error {
  border-color: #ef4444 !important;     /* red-500 */
  box-shadow: 0 0 0 1px #ef4444;
}

.handbuch-editor-fielderror {
  display: block;
  color: #b91c1c;                       /* red-700 */
  font-size: 13px;
  margin-top: 0.25rem;
  font-weight: 500;
}

/* =========================================================================
 * Handbuch — Vorschau-Hilfsklassen (HDB-5.5, A06)
 *
 * Visuelle Komponenten für die Editor-Vorschau-Route
 * (`POST /handbuch/editor/<datei_id>/vorschau` → templates/handbuch/
 * vorschau.html). Bewusst auffällige Farben (gelb-amber), damit ein
 * Vorschau-Tab nie mit einer Lese-Ansicht verwechselt wird.
 *
 * Klassen:
 *   .handbuch-vorschau-banner        — Prominentes Banner oben („— VORSCHAU
 *                                      — nicht gespeichert"). Gelb-amber.
 *   .handbuch-vorschau-banner-text   — Sub-Klasse für den Hinweis-Text rechts
 *                                      neben dem fettgedruckten Banner-Titel.
 *   .handbuch-vorschau-sanitize-banner — Sekundäres Banner, wenn bleach Tags
 *                                      oder Attribute entfernt hat. Hellrot.
 *   .handbuch-vorschau-card          — Variante der `.handbuch-page-card` mit
 *                                      gestrichelter gelber Außenkante, damit
 *                                      die Vorschau visuell als „nicht echt"
 *                                      lesbar bleibt.
 *
 * Visibility-Disziplin: keine `display:none`-Defaults; die Banner
 * werden ausschließlich server-side conditional gerendert
 * (`{% if vorschau_entfernte_tags or vorschau_entfernte_attribute %}`).
 * ========================================================================= */

.handbuch-vorschau-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 0.9rem 1.25rem;
  border-radius: 8px;
  background: #fef3c7;                  /* amber-100 */
  border: 2px dashed #f59e0b;           /* amber-500 */
  color: #78350f;                       /* amber-900 */
  font-size: 15px;
  margin-bottom: 1rem;
}

.handbuch-vorschau-banner strong {
  font-weight: 700;
  letter-spacing: 0.05em;
}

.handbuch-vorschau-banner-text {
  font-size: 14px;
  line-height: 1.5;
}

.handbuch-vorschau-sanitize-banner {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: #fef2f2;                  /* red-50 */
  border: 1px solid #fecaca;            /* red-200 */
  color: #991b1b;                       /* red-800 */
  font-size: 14px;
  margin-bottom: 1rem;
}

.handbuch-vorschau-sanitize-banner strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.handbuch-vorschau-sanitize-banner p {
  margin: 0.25rem 0;
  line-height: 1.5;
}

.handbuch-vorschau-sanitize-banner code {
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
               Menlo, Consolas, monospace;
  font-size: 13px;
}

.handbuch-vorschau-card {
  /* Variante der Standard-Page-Card mit hauchzartem gelbem Außen-Tint —
     so erkennt der Autor auf einen Blick, dass das nicht der echte
     Lese-View ist. */
  outline: 2px dashed #f59e0b;          /* amber-500 */
  outline-offset: 6px;
}

/* =========================================================================
 * HDB-6.2 — Deaktiviert-Banner (Admin-Sicht für deaktivierte Seiten)
 * =========================================================================
 *
 * Verwendet von `templates/handbuch/seite.html` ÜBER dem Seitenkopf,
 * wenn `seite.aktiv == False`. Reader (PgmBer 4..9) sehen deaktivierte
 * Seiten nicht (`routes.seite()` liefert 404), deshalb sieht dieses
 * Banner ausschließlich der Admin (PgmBer 1..3).
 *
 * Visual-Sprache: rot-getönte Hinweis-Box (Red-50/Red-200/Red-800) —
 * konsistent mit `.handbuch-vorschau-sanitize-banner` (rot = „Achtung,
 * Inhalt nicht im Regelfluss") und absichtlich auffälliger als
 * `.handbuch-vorschau-banner` (gelb-amber, „nur ein Hinweis").
 *
 * Visibility-Disziplin (`frontend/visibility-toggles.md`): KEIN
 * `display:none`-Default — die Klasse rendert immer sichtbar. Der
 * Banner wird ausschließlich server-side conditional rendered
 * (`{% if not seite.aktiv %}`), keine JS-Toggles.
 * ========================================================================= */

.handbuch-deaktiviert-banner {
  padding: 0.9rem 1.25rem;
  border-radius: 8px;
  background: #fef2f2;                  /* red-50 */
  border: 1px solid #fecaca;            /* red-200 */
  border-left: 4px solid #dc2626;       /* red-600 */
  color: #991b1b;                       /* red-800 */
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.handbuch-deaktiviert-banner strong {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 0.4rem;
  color: #7f1d1d;                       /* red-900 */
}

.handbuch-deaktiviert-banner p {
  margin: 0;
  color: #991b1b;                       /* red-800 */
}

/* Edit-Action-Footer (HDB-REFINE-3): Wrapper-Block für die Autor/Admin-
 * Buttons („Seite bearbeiten", „+ Neue Seite anlegen", „Versionshistorie",
 * „Seite deaktivieren") direkt unter den Vor/Zurück-Cards.
 *
 * Davor hatte die Klasse kein eigenes Styling — die Buttons klebten ohne
 * Abstand an `.handbuch-foot-nav`. Wir spiegeln das Muster der Vor/Zurück-
 * Nav (margin-top + padding-top + border-top als zarte Trennlinie),
 * sodass der Edit-Footer optisch als eigene Sektion gelesen wird.
 *
 * Flex + gap regelt den Inter-Button-Abstand; flex-wrap sorgt dafür, dass
 * auf schmalen Viewports umgebrochen wird, statt dass die Buttons aus der
 * Page-Card hinausragen. */
.handbuch-seite-edit-action {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;        /* gray-200 — identisch zu .handbuch-foot-nav */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Deaktivieren-Button im edit-action-Footer trägt einen leichten roten
 * Akzent (`color`-Override), damit er sich von „Bearbeiten" und „Neue
 * Seite anlegen" abhebt. Wir bauen NICHT eine neue `.btn-danger`-Klasse
 * (würde ein größeres Design-System-Statement erfordern); stattdessen
 * variieren wir den `btn-secondary` minimal über eine Spezial-Sub-Klasse. */
.handbuch-seite-deaktivieren-btn {
  color: #b91c1c;                       /* red-700 */
}

.handbuch-seite-deaktivieren-btn:hover {
  background-color: #fef2f2;            /* red-50 — sanfter Hover-Tint */
  border-color: #fecaca;                /* red-200 */
}

/* Die `<form>`-Hülle um den Button sitzt im edit-action-Flex-Block —
 * `display:inline` damit das Form keinen Block-Break erzeugt und der
 * Button neben den anderen edit-action-Buttons stehen kann. */
.handbuch-seite-deaktivieren-form {
  display: inline;
  margin: 0;
}

/* ===========================================================================
 * Versionshistorie + Inline-Diff (HDB-6.4 — AD06–AD08, §6.13)
 *
 * Wird verwendet in:
 *   - `templates/handbuch/versionshistorie.html` (Tabelle der Versions-
 *     Einträge mit Diff-Toggle-Checkboxen und Wiederherstellen-Buttons)
 *   - `templates/handbuch/versionsdiff.html` (Inline-Diff-Anzeige zweier
 *     Snapshots mit Vergleichs-Header und Legende)
 *
 * Klassen-Übersicht:
 *   .handbuch-historie-card       — Variante der .handbuch-page-card
 *   .handbuch-historie-header     — h1 + Sub-Header + Zurück-Link
 *   .handbuch-historie-tabelle    — die Versions-Tabelle (Striped Rows)
 *   .handbuch-historie-td-*       — Spaltentyp-spezifisches Styling
 *   .handbuch-historie-footer     — „Vergleichen"-Button + Hinweis
 *   .handbuch-historie-empty      — Empty-State-Hinweis
 *   .handbuch-historie-restore-form-out — Out-of-Body Wiederherstellen-
 *                                         Forms (display:none, referenziert
 *                                         per `form="…"`-Attribut der
 *                                         Tabellen-Buttons)
 *
 *   .handbuch-diff-card           — Variante der .handbuch-page-card
 *   .handbuch-diff-vergleich      — 2-Spalten-Header (alt|neu)
 *   .handbuch-diff-karte          — eine Karte im Vergleichs-Header
 *   .handbuch-diff-legende        — Hinweistext (grün/rot)
 *   .handbuch-diff-empty-banner   — Hinweis, wenn beide Snapshots
 *                                   nach Sanitisierung identisch sind
 *   .handbuch-diff-output         — Container für den Diff-HTML-Stream
 *
 *   .handbuch-diff-add            — Inline-Marker: hinzugefügter Text (grün)
 *   .handbuch-diff-del            — Inline-Marker: entfernter Text (rot)
 *
 * Performance-Hinweis: Die Tabelle rendert typischerweise < 100 Zeilen
 * (Mock-Phase: 0–5 pro Seite; reale Spitzen-Werte unbekannt, voraussichtlich
 * < 50). Keine Pagination, kein Virtual-Scrolling.
 * ========================================================================= */

/* ---- Historie-Karte (Wrapper) ---- */
.handbuch-historie-card {
  padding: 1.5rem;
}

.handbuch-historie-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;                         /* gray-900 */
}

.handbuch-historie-sub {
  margin: 0 0 0.5rem 0;
  color: #374151;                         /* gray-700 */
  font-size: 0.95rem;
}

.handbuch-historie-sub-label {
  color: #6b7280;                         /* gray-500 */
}

.handbuch-historie-sub-version {
  margin-left: 0.5rem;
  color: #6b7280;                         /* gray-500 */
  font-size: 0.875rem;
}

.handbuch-historie-zurueck {
  margin: 0.25rem 0 1rem 0;
  font-size: 0.875rem;
}

.handbuch-historie-zurueck a {
  color: #2563eb;                         /* blue-600 */
  text-decoration: none;
}

.handbuch-historie-zurueck a:hover {
  text-decoration: underline;
}

/* ---- Historie-Tabelle ---- */
.handbuch-historie-tabelle {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.handbuch-historie-tabelle thead {
  background-color: #f9fafb;              /* gray-50 */
  border-bottom: 2px solid #e5e7eb;       /* gray-200 */
}

.handbuch-historie-tabelle th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  color: #374151;                         /* gray-700 */
  white-space: nowrap;
}

.handbuch-historie-tabelle tbody tr {
  border-bottom: 1px solid #f3f4f6;       /* gray-100 */
}

.handbuch-historie-tabelle tbody tr:hover {
  background-color: #f9fafb;              /* gray-50 */
}

.handbuch-historie-tabelle td {
  padding: 0.6rem 0.75rem;
  vertical-align: top;
  color: #111827;                         /* gray-900 */
}

.handbuch-historie-td-diff {
  width: 4.5rem;
  text-align: center;
}

.handbuch-historie-td-version,
.handbuch-historie-td-rn,
.handbuch-historie-td-ver {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.handbuch-historie-td-zeit {
  white-space: nowrap;
  color: #4b5563;                         /* gray-600 */
}

.handbuch-historie-td-aktion {
  white-space: nowrap;
}

.handbuch-historie-diff-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

/* ---- Historie-Footer ---- */
.handbuch-historie-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;          /* gray-200 */
}

.handbuch-historie-hinweis {
  margin: 0;
  color: #6b7280;                         /* gray-500 */
  font-size: 0.875rem;
}

.handbuch-historie-vergleichen-btn {
  flex-shrink: 0;
}

.handbuch-historie-restore-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Out-of-Body-Container der Wiederherstellen-Forms — `<form>`-Verschachtelung
 * ist HTML5-verboten, daher liegen sie unterhalb des Vergleichen-Forms und
 * werden per `form="…"`-Attribut der Tabellen-Buttons referenziert. Die
 * Forms selbst dürfen nicht visuell rendern. */
.handbuch-historie-restore-form-out {
  display: none;
}

.handbuch-historie-empty {
  margin-top: 1rem;
  padding: 1.25rem;
  background-color: #f9fafb;              /* gray-50 */
  border: 1px dashed #d1d5db;             /* gray-300 */
  border-radius: 8px;
  color: #6b7280;                         /* gray-500 */
  text-align: center;
}

/* ---- Diff-Karte ---- */
.handbuch-diff-card {
  padding: 1.5rem;
}

.handbuch-diff-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.handbuch-diff-sub {
  margin: 0 0 1rem 0;
  color: #374151;
  font-size: 0.95rem;
}

.handbuch-diff-sub-label {
  color: #6b7280;
}

.handbuch-diff-vergleich {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.handbuch-diff-karte {
  flex: 1 1 280px;
  border: 1px solid #e5e7eb;              /* gray-200 */
  border-radius: 8px;
  background-color: #f9fafb;              /* gray-50 */
  padding: 0.75rem 1rem;
}

.handbuch-diff-karte-alt {
  border-left: 4px solid #fca5a5;         /* red-300 — visueller Hinweis */
}

.handbuch-diff-karte-neu {
  border-left: 4px solid #86efac;         /* green-300 */
}

.handbuch-diff-karte-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.handbuch-diff-karte-content p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
  color: #111827;
}

.handbuch-diff-legende {
  margin: 0.5rem 0 0 0;
  padding: 0.6rem 0.9rem;
  background-color: #fffbeb;              /* amber-50 */
  border-left: 4px solid #fbbf24;         /* amber-400 */
  border-radius: 4px;
  color: #78350f;                         /* amber-900 */
  font-size: 0.875rem;
}

.handbuch-diff-zurueck {
  margin: 0.75rem 0 0 0;
  font-size: 0.875rem;
}

.handbuch-diff-zurueck a {
  color: #2563eb;
  text-decoration: none;
}

.handbuch-diff-zurueck a:hover {
  text-decoration: underline;
}

.handbuch-diff-empty-banner {
  margin: 1rem 0;
  padding: 0.9rem 1.25rem;
  background-color: #eff6ff;              /* blue-50 */
  border: 1px solid #bfdbfe;              /* blue-200 */
  border-radius: 8px;
  color: #1e3a8a;                         /* blue-900 */
}

.handbuch-diff-output {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

/* ---- Inline-Diff-Marker (Render-Artefakt) ----
 *
 * `<ins class="handbuch-diff-add">` und `<del class="handbuch-diff-del">`
 * werden von `handbuch.diff.erzeuge_inline_diff(...)` im Inhalts-Fluss
 * eingebettet. Die Marker bleiben Inline-Tags, damit sie sich nahtlos
 * mit den umgebenden `<p>`/`<strong>`/etc. mischen — kein Block-Break.
 *
 * Farbgebung:
 *   - Add (grün): hellgrüner Hintergrund + dunkleres Grün als Text.
 *   - Del (rot):  hellroter Hintergrund + Durchstreichung.
 */
.handbuch-diff-add {
  background-color: #d1fae5;              /* green-100 */
  color: #065f46;                         /* green-800 */
  text-decoration: none;
  padding: 0 0.1rem;
  border-radius: 2px;
}

.handbuch-diff-del {
  background-color: #fee2e2;              /* red-100 */
  color: #991b1b;                         /* red-800 */
  text-decoration: line-through;
  padding: 0 0.1rem;
  border-radius: 2px;
}

/* ---------------------------------------------------------------------------
 * Navigation-Verwaltung (HDB-6.5, AD05)
 *
 * Klassen:
 *   .handbuch-admin-nav-card           — Outer-Wrapper (Page-Card)
 *   .handbuch-admin-nav-header         — h1 + Intro-Text
 *   .handbuch-admin-nav-banner         — Validation-Fehler-Banner (rot)
 *   .handbuch-admin-nav-form           — Outer-Form (POST)
 *   .handbuch-admin-nav-tree           — Top-`<ul>`
 *   .handbuch-admin-nav-subtree        — Nested-`<ul>` (Indent)
 *   .handbuch-admin-nav-subtree.is-closed — kollabiert (display:none) [HDB-REFINE-7]
 *   .handbuch-admin-nav-toggle         — Caret links der Zeile (▾/▸ via rotate)
 *   .handbuch-admin-nav-toggle.is-closed — Caret rotiert -90deg (▸-Optik)
 *   .handbuch-admin-nav-toggle-placeholder — visibility:hidden Spacer für Leafs
 *   .handbuch-admin-nav-node           — `<li>` pro Knoten
 *   .handbuch-admin-nav-node.is-just-moved — Flash-Highlight nach Mutation [HDB-REFINE-7]
 *   .handbuch-admin-nav-row            — Inner-Container (Caret + Buttons + Label + DateiID)
 *   .handbuch-admin-nav-ops            — Container der vier Buttons
 *   .handbuch-admin-nav-btn            — Generic Button-Stil
 *   .handbuch-admin-nav-btn-up/.-down/.-indent/.-outdent — modifier
 *   .handbuch-admin-nav-label          — Inline-editierbare Bezeichnung
 *   .handbuch-admin-nav-label-input    — Aktives <input>-Form-Feld
 *   .handbuch-admin-nav-datei          — DateiID-Container (rechts)
 *   .handbuch-admin-nav-datei-id       — Monospace-DateiID
 *   .handbuch-admin-nav-datei-group    — Gruppen-Marker (kursiv)
 *   .handbuch-admin-nav-deaktiviert-marker — kleines "×"-Icon
 *   .handbuch-admin-nav-footer         — Speichern-Button + Zurücksetzen-Link
 *   .handbuch-admin-nav-updates-container — display:none (Hidden-Inputs)
 *   .handbuch-admin-nav-empty          — Empty-State
 *
 * Visuelle Design-Wahl: Einrückung erfolgt über `padding-left` auf den
 * `<ul>`-Subtrees, nicht über CSS-Variablen mit `--ebene`. Das ist
 * einfacher und entspricht dem nativen Listen-Verhalten. Hover-Highlight
 * pro Zeile signalisiert die fokussierbare Reihe.
 * --------------------------------------------------------------------------- */

.handbuch-admin-nav-card {
  padding: 1.5rem;
}

.handbuch-admin-nav-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;       /* gray-200 */
}

.handbuch-admin-nav-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;                         /* gray-900 */
}

.handbuch-admin-nav-intro {
  margin: 0;
  color: #6b7280;                         /* gray-500 */
  font-size: 0.95rem;
}

.handbuch-admin-nav-banner {
  margin: 0 0 1rem 0;
  padding: 0.9rem 1.25rem;
  background-color: #fef2f2;              /* red-50 */
  border: 1px solid #fecaca;              /* red-200 */
  border-radius: 8px;
  color: #991b1b;                         /* red-800 */
}

.handbuch-admin-nav-banner strong {
  display: block;
  margin-bottom: 0.25rem;
}

.handbuch-admin-nav-banner p {
  margin: 0;
}

.handbuch-admin-nav-form {
  /* Kein zusätzliches Padding — die `.handbuch-admin-nav-card` ist der
   * primäre Container. */
}

.handbuch-admin-nav-tree,
.handbuch-admin-nav-subtree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.handbuch-admin-nav-subtree {
  /* Indent. Wir nutzen `padding-left` (nicht `margin-left`), damit der
   * Hover-Highlight der Zeile durch den eingerückten Bereich
   * durchgezogen wird. */
  padding-left: 1.5rem;
  border-left: 1px dashed #e5e7eb;        /* gray-200 */
  margin-left: 0.5rem;
}

/* HDB-REFINE-7 — Collapse-State. Wenn die Subtree-UL `.is-closed`
 * trägt (von `hydrate()` initial gesetzt, vom Toggle-Handler geflippt),
 * wird sie komplett unsichtbar. Reiner `display:none`-Switch über eine
 * State-Klasse — entspricht `frontend/visibility-toggles.md`-Disziplin
 * (Basis-Klasse trägt KEIN `display:*`, der Toggle kommt ausschliesslich
 * aus `.is-closed`). */
.handbuch-admin-nav-subtree.is-closed { display: none; }

/* Caret links vor der Buttons-Gruppe. 1rem-Box (gleiche Höhe wie die
 * Aktions-Buttons, aber ohne Border/Background), klickbar, Hover-Tint.
 * Default-Glyph in der Template-Quelle ist ▾ (zeigt: "offen" = Pfeil
 * nach unten). Bei `.is-closed` rotieren wir um -90deg, sodass der
 * Pfeil nach rechts zeigt (▸-Optik). So bleibt das Markup identisch
 * für beide Zustände — keine Glyph-Manipulation per JS nötig. */
.handbuch-admin-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1.85rem;                        /* match nav-btn height */
  flex-shrink: 0;
  color: #6b7280;                         /* gray-500 */
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 150ms ease, color 150ms ease;
}
.handbuch-admin-nav-toggle:hover {
  color: #111827;                         /* gray-900 */
}
.handbuch-admin-nav-toggle:focus-visible {
  outline: 2px solid #2563eb;             /* blue-600 */
  outline-offset: 2px;
  border-radius: 2px;
}
.handbuch-admin-nav-toggle.is-closed {
  transform: rotate(-90deg);
}
/* Leaf-Knoten: Platzhalter mit derselben Breite, aber unsichtbar und
 * unklickbar. Hält die Buttons-Spalte zwischen Geschwister-Zeilen
 * exakt aligned, auch wenn manche Reihen ein Caret haben und manche
 * nicht (Spec-Anforderung: Knoten mit datei_id sind Blätter, Gruppen-
 * Knoten haben Kinder). */
.handbuch-admin-nav-toggle-placeholder {
  visibility: hidden;
  cursor: default;
}

/* HDB-REFINE-7 — Highlight für die zuletzt bewegte Zeile (~1.2s Flash
 * nach indent/outdent). Hilft dem User die neue Position zu finden,
 * selbst wenn das Auto-Open des Ziel-Subtree den richtigen Bereich
 * sichtbar gemacht hat. Pure CSS-Animation — kein JS-Timer nötig
 * ausser dem Klassen-Add/Remove. */
.handbuch-admin-nav-node.is-just-moved > .handbuch-admin-nav-row {
  animation: handbuch-admin-nav-flash 1.2s ease-out;
}
@keyframes handbuch-admin-nav-flash {
  0%   { background-color: #fef08a; }    /* yellow-200 */
  40%  { background-color: #fef9c3; }    /* yellow-100 */
  100% { background-color: transparent; }
}

.handbuch-admin-nav-node {
  margin: 0;
  padding: 0;
}

.handbuch-admin-nav-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}

.handbuch-admin-nav-row:hover {
  background-color: #f9fafb;              /* gray-50 */
}

/* Buttons-Gruppe — links der Zeile. Vier Buttons in einer Reihe;
 * leicht erkennbar als Block. */
.handbuch-admin-nav-ops {
  display: inline-flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.handbuch-admin-nav-btn {
  /* Sehr kompakte Buttons — wir haben vier pro Zeile und brauchen
   * Platz. Padding ist minimal; Icon-Text reicht. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  background-color: #ffffff;
  border: 1px solid #d1d5db;              /* gray-300 */
  border-radius: 4px;
  color: #374151;                         /* gray-700 */
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.handbuch-admin-nav-btn:hover:not(:disabled) {
  background-color: #f3f4f6;              /* gray-100 */
  border-color: #9ca3af;                  /* gray-400 */
}

.handbuch-admin-nav-btn:focus-visible {
  outline: 2px solid #2563eb;             /* blue-600 */
  outline-offset: 2px;
}

.handbuch-admin-nav-btn:disabled {
  background-color: #f9fafb;              /* gray-50 */
  color: #d1d5db;                         /* gray-300 */
  cursor: not-allowed;
}

/* Inline-editierbare Bezeichnung. Cursor:pointer zeigt dem User, dass
 * der Text klickbar ist; Hover hebt zusätzlich hervor. */
.handbuch-admin-nav-label {
  flex: 1 1 auto;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  color: #111827;                         /* gray-900 */
  cursor: text;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.handbuch-admin-nav-label:hover {
  background-color: #fef3c7;              /* yellow-100 */
}

.handbuch-admin-nav-label:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

/* Aktives Input-Feld (während Inline-Edit). Übernimmt visuell den
 * Platz des Spans, damit kein Layout-Sprung passiert. */
.handbuch-admin-nav-label-input {
  flex: 1 1 auto;
  padding: 0.15rem 0.4rem;
  border: 1px solid #2563eb;              /* blue-600 */
  border-radius: 3px;
  font-size: inherit;
  font-family: inherit;
  color: #111827;
  background-color: #ffffff;
  min-width: 0;
}

.handbuch-admin-nav-datei {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.handbuch-admin-nav-datei-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #4b5563;                         /* gray-600 */
  background-color: #f3f4f6;              /* gray-100 */
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.handbuch-admin-nav-datei-group {
  color: #9ca3af;                         /* gray-400 */
  font-style: italic;
}

.handbuch-admin-nav-deaktiviert-marker {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background-color: #fee2e2;              /* red-100 */
  color: #991b1b;                         /* red-800 */
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Hidden-Inputs-Container — er enthält nur `<input type="hidden">`-
 * Elemente, die das JS beim Submit befüllt. Visuell soll er nicht
 * gerendert werden. Wir verstecken ihn KOMPLETT (display:none) statt
 * `aria-hidden`, weil reine Form-Felder keine ARIA-Treeitems sind. */
.handbuch-admin-nav-updates-container {
  display: none;
}

.handbuch-admin-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;          /* gray-200 */
}

.handbuch-admin-nav-reset {
  color: #6b7280;                         /* gray-500 */
  text-decoration: none;
  font-size: 0.9rem;
}

.handbuch-admin-nav-reset:hover {
  color: #2563eb;                         /* blue-600 */
  text-decoration: underline;
}

.handbuch-admin-nav-speichern-btn {
  flex-shrink: 0;
}

.handbuch-admin-nav-empty {
  margin-top: 1rem;
  padding: 1.25rem;
  background-color: #f9fafb;              /* gray-50 */
  border: 1px dashed #d1d5db;             /* gray-300 */
  border-radius: 8px;
  color: #6b7280;                         /* gray-500 */
  text-align: center;
}

/* Knoten, deren `data-aktiv="0"` → die Bezeichnung wird visuell als
 * deaktiviert dargestellt (analog zum Reader-Nav-Tree). */
.handbuch-admin-nav-node[data-aktiv="0"] > .handbuch-admin-nav-row > .handbuch-admin-nav-label {
  color: #9ca3af;                         /* gray-400 */
  text-decoration: line-through;
}

/* Dirty-Highlight — vom JS gesetzt, wenn der Knoten gegenüber dem
 * Original-Snapshot verändert wurde. Hilft dem Admin, beim Save-
 * Klick zu sehen, was er gerade einreicht. */
.handbuch-admin-nav-node[data-dirty="1"] > .handbuch-admin-nav-row {
  background-color: #fefce8;              /* yellow-50 */
  border-left: 3px solid #facc15;         /* yellow-400 */
  padding-left: calc(0.5rem - 3px);
}

/* ===========================================================================
 * HDB-6.6 — Formular-Verwaltung (AD09, §6.9)
 *
 * Klassen-Vergabe folgt dem Pattern `handbuch-formulare-admin-*`:
 *
 *   .handbuch-formulare-admin-card       — Variante der .handbuch-page-card
 *   .handbuch-formulare-admin-header     — Sub-Header (Titel + Intro)
 *   .handbuch-formulare-admin-filter*    — Filter-Form
 *   .handbuch-formulare-admin-upload*    — Upload-Form
 *   .handbuch-formulare-admin-list*      — Tabellen-Wrapper
 *   .handbuch-formulare-admin-tabelle    — Die Tabelle selbst
 *   .handbuch-formulare-admin-td-*       — Spalten-spezifische Cells
 *   .handbuch-formulare-admin-tr-deaktiviert — gedimmte Zeile für aktiv=False
 *   .handbuch-formulare-admin-badge-*    — Status-Badges (aktiv/inaktiv)
 *   .handbuch-formulare-admin-btn-*      — Toggle-Buttons
 *   .handbuch-formulare-admin-download-link — Datei-Anchor
 *
 * Farbgebung knüpft an die etablierten Handbuch-Paletten aus
 * .handbuch-historie-tabelle / .handbuch-page-card an — kein neues
 * Farbschema.
 * =========================================================================== */

.handbuch-formulare-admin-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.handbuch-formulare-admin-header h1 {
  margin: 0 0 0.4rem 0;
  font-size: 1.6rem;
  color: #111827;                         /* gray-900 */
}

.handbuch-formulare-admin-sub {
  margin: 0;
  color: #4b5563;                         /* gray-600 */
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---- Filter-Sektion ---- */
.handbuch-formulare-admin-filter {
  padding: 0.85rem 1rem;
  background-color: #f9fafb;              /* gray-50 */
  border: 1px solid #e5e7eb;              /* gray-200 */
  border-radius: 8px;
}

.handbuch-formulare-admin-filter-form {
  margin: 0;
}

.handbuch-formulare-admin-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.handbuch-formulare-admin-filter-label {
  font-weight: 600;
  color: #374151;                         /* gray-700 */
  font-size: 0.92rem;
}

.handbuch-formulare-admin-filter-select {
  min-width: 12rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #d1d5db;              /* gray-300 */
  border-radius: 6px;
  background-color: #ffffff;
  font-size: 0.95rem;
  color: #111827;
}

.handbuch-formulare-admin-filter-btn {
  padding: 0.45rem 0.9rem;
}

.handbuch-formulare-admin-filter-reset {
  color: #2563eb;                         /* blue-600 */
  text-decoration: none;
  font-size: 0.92rem;
}

.handbuch-formulare-admin-filter-reset:hover {
  text-decoration: underline;
}

/* ---- Upload-Form ---- */
.handbuch-formulare-admin-upload {
  padding: 1rem 1.1rem;
  border: 1px solid #d1d5db;              /* gray-300 */
  border-radius: 8px;
  background-color: #ffffff;
}

.handbuch-formulare-admin-upload-h2 {
  margin: 0 0 0.4rem 0;
  font-size: 1.15rem;
  color: #111827;
}

.handbuch-formulare-admin-upload-hinweis {
  margin: 0 0 1rem 0;
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.45;
}

.handbuch-formulare-admin-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.handbuch-formulare-admin-upload-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.handbuch-formulare-admin-upload-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.92rem;
}

.handbuch-formulare-admin-upload-required {
  color: #b91c1c;                         /* red-700 */
  margin-left: 0.15rem;
}

.handbuch-formulare-admin-upload-file,
.handbuch-formulare-admin-upload-select,
.handbuch-formulare-admin-upload-text {
  padding: 0.5rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  font-size: 0.95rem;
  color: #111827;
}

.handbuch-formulare-admin-upload-actions {
  margin-top: 0.4rem;
}

/* ---- Tabellen-Sektion ---- */
/* HDB-REFINE-8 (2026-05-18, PORTAL_VERSION 0.4.86) — eigene Card-
 * Umrandung, parallel zur Upload-Sektion darüber. User-Feedback:
 * „Überschrift und Schaltflächen ragen über den Rahmen hinaus" —
 * vorher hatte die Liste KEIN Border/Padding, also klebten Heading
 * und Tabelle visuell ohne Rahmen an den Article-Kanten. Mit eigener
 * Card sitzen sie jetzt sauber INNERHALB einer Bounding-Box, parallel
 * zum Upload-Bereich. `overflow-x:auto` sorgt dafür, dass die Tabelle
 * bei schmalen Viewports horizontal scrollt statt aus der Card zu
 * fließen — die 7 Spalten haben teilweise `white-space:nowrap` und
 * können in Summe breiter werden als der verfügbare Platz. */
.handbuch-formulare-admin-list {
  padding: 1rem 1.1rem;
  border: 1px solid #d1d5db;              /* gray-300 — wie Upload */
  border-radius: 8px;
  background-color: #ffffff;
  overflow-x: auto;
}

.handbuch-formulare-admin-list-h2 {
  margin: 0 0 0.6rem 0;
  font-size: 1.15rem;
  color: #111827;
}

.handbuch-formulare-admin-list-count {
  color: #6b7280;                         /* gray-500 */
  font-weight: 400;
  font-size: 0.95rem;
}

.handbuch-formulare-admin-empty {
  margin: 0.5rem 0;
  padding: 1rem;
  background-color: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  color: #4b5563;
  text-align: center;
}

.handbuch-formulare-admin-tabelle {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.93rem;
}

.handbuch-formulare-admin-tabelle thead {
  background-color: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.handbuch-formulare-admin-tabelle th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.handbuch-formulare-admin-tabelle tbody tr {
  border-bottom: 1px solid #f3f4f6;
}

.handbuch-formulare-admin-tabelle tbody tr:hover {
  background-color: #f9fafb;
}

.handbuch-formulare-admin-tabelle td {
  padding: 0.55rem 0.7rem;
  vertical-align: top;
  color: #111827;
}

/* Deaktivierte Zeile: gedimmt, aber sichtbar — Admin sieht sofort, was
 * nicht aktiv ist (KEIN `display:none`, KEIN `hidden`). */
.handbuch-formulare-admin-tr-deaktiviert {
  background-color: #f9fafb;
  color: #6b7280;
}

.handbuch-formulare-admin-tr-deaktiviert td {
  color: #6b7280;
}

.handbuch-formulare-admin-tr-deaktiviert .handbuch-formulare-admin-download-link {
  color: #6b7280;
  text-decoration: line-through;
}

.handbuch-formulare-admin-download-link {
  color: #2563eb;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.handbuch-formulare-admin-download-link:hover {
  text-decoration: underline;
}

.handbuch-formulare-admin-td-zeit {
  white-space: nowrap;
  color: #4b5563;
}

.handbuch-formulare-admin-td-status {
  white-space: nowrap;
}

.handbuch-formulare-admin-badge-aktiv,
.handbuch-formulare-admin-badge-inaktiv {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.handbuch-formulare-admin-badge-aktiv {
  background-color: #d1fae5;              /* green-100 */
  color: #065f46;                         /* green-800 */
}

.handbuch-formulare-admin-badge-inaktiv {
  background-color: #fee2e2;              /* red-100 */
  color: #991b1b;                         /* red-800 */
}

.handbuch-formulare-admin-toggle-form {
  margin: 0;
}

.handbuch-formulare-admin-btn-aktivieren,
.handbuch-formulare-admin-btn-deaktivieren {
  padding: 0.3rem 0.7rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* =========================================================================
 * Aside-Side-Cards (HDB-REFINE-2, 2026-05-18)
 * -------------------------------------------------------------------------
 * Drei Cards in der rechten Spalte (`.handbuch-aside-col`), gerendert
 * von den Macros in `templates/handbuch/_aside.html`:
 *
 *   .handbuch-side-card              — Card-Hülle (weiss, grauer Rand)
 *   .handbuch-side-card-title        — Card-Überschrift
 *   .handbuch-side-search-*          — Volltextsuche-Card
 *   .handbuch-az-strip               — 7-Spalten-Grid für die 30
 *                                       A-Z-Buchstaben (kompakter
 *                                       Mini-Picker, distinct vom
 *                                       grossen `.handbuch-az-
 *                                       quickpicker` im Inhalt-Bereich)
 *   .handbuch-related-list           — „Auch hilfreich"-Liste mit
 *                                       Titel + monospaced Randnummer
 *
 * Mockup-Referenz: `purple/documentation/260518-anforderungskatalog-
 * systemhandbuch/attachments/lese-ansicht-mockup.html` Zeilen 558–625
 * (Original-CSS) + 969–1019 (Markup).
 *
 * Responsive:
 *   < 1100 px  — `.handbuch-aside-col` ist via Media-Query in der
 *                Grid-Definition (siehe oben) komplett hidden. Die
 *                Cards rendern trotzdem im DOM (server-side), aber
 *                sichtbar sind sie nicht.
 *   >= 1100 px (data-aside="filled") — Cards stacken in der 280-px-
 *                Spalte, `position: sticky`, gap 1rem (siehe
 *                `.handbuch-layout[data-aside="filled"] .handbuch-aside-col`
 *                weiter oben).
 *
 * Visibility-Toggles-Disziplin: Keine `hidden`-Klassen, keine JS-
 * Toggles. Sichtbarkeit hängt am Server-`{% if %}` (Macro selbst
 * rendert nichts bei leerem Input) und am Grid-Layout.
 * ========================================================================= */

.handbuch-side-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;              /* gray-200 */
  border-radius: 8px;
  padding: 0.875rem 1rem;
}

.handbuch-side-card-title {
  /* Konsistent mit `.handbuch-panel-title` in den Mockup-Cards. */
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #4b5563;                          /* gray-600 */
  margin-bottom: 0.5rem;
}

/* ---- Volltextsuche-Card (Side-Variante) ---- */
.handbuch-side-search-form {
  display: flex;
  gap: 0.375rem;
  align-items: stretch;
}

.handbuch-side-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.625rem;
  border: 1px solid #d1d5db;               /* gray-300 */
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
}

.handbuch-side-search-input:focus {
  outline: none;
  border-color: #2E7D32;                   /* DTL-Grün */
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.handbuch-side-search-submit {
  /* Wir nutzen kein btn-primary-Sizing — das wäre für die schmale
     Aside-Spalte zu wuchtig. Eigene kompakte Pille mit DTL-Grün. */
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem;
  font-size: 12px;
  font-weight: 600;
  background: #2E7D32;                     /* DTL-Grün */
  color: #ffffff;
  border: 1px solid #2E7D32;
  border-radius: 6px;
  cursor: pointer;
}

.handbuch-side-search-submit:hover {
  background: #1B5E20;                     /* DTL-Grün dunkler */
  border-color: #1B5E20;
}

.handbuch-side-search-tip {
  margin-top: 0.5rem;
  font-size: 11px;
  color: #6b7280;                          /* gray-500 */
  line-height: 1.4;
}

/* ---- A-Z-Strip (Side-Variante: 7-Spalten-Mini-Picker) ---- */
.handbuch-az-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 0.25rem;
}

.handbuch-az-strip-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;                          /* gray-700 */
  background: #f9fafb;                     /* gray-50 */
  border-radius: 3px;
  text-decoration: none;
}

.handbuch-az-strip-letter:hover {
  background: #ecfdf5;                     /* DTL-Grün-Background */
  color: #1B5E20;                          /* DTL-Grün dunkler */
}

.handbuch-az-strip-disabled {
  color: #d1d5db;                          /* gray-300 */
  background: transparent;
  /* `<span aria-disabled>` — kein Klick, daher kein `pointer-events`
     nötig (das Element ist von Haus aus inert). */
}

/* ---- „Auch hilfreich"-Liste ---- */
.handbuch-related-list {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.handbuch-related-link {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: #374151;                          /* gray-700 */
  font-size: 12.5px;
  line-height: 1.35;
}

.handbuch-related-link:hover {
  background: #f9fafb;                     /* gray-50 */
  color: #1B5E20;                          /* DTL-Grün dunkler */
}

.handbuch-related-title {
  flex: 1 1 auto;
  min-width: 0;
}

.handbuch-related-list-rn {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: #9ca3af;                          /* gray-400 */
  flex: 0 0 auto;
}

/* ===========================================================================
   DocBridge Landing-Page + Posteingang-Modal (Etappe B1, 2026-05-23)
   --------------------------------------------------------------------------- */

.docbridge-landing {
  padding: 1.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.docbridge-chip {
  /* Flex (block-level) + width: fit-content lässt `margin: 0 auto`
     den Chip horizontal zentrieren — anders als `inline-flex`, das
     mit `margin: auto` nicht zentriert. */
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.9em;
  background: #e6f4ea;                     /* DTL-Grün hellster Ton */
  color: #1e5b34;                          /* DTL-Grün dunkler Ton */
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 1.5rem auto 1rem;
}

.docbridge-chip-dot {
  color: #1e5b34;
}

/* 0.5.267: DocBridge-Eyebrow im Sendungsverfolgung-Layout (.hero-eyebrow),
   aber zentriert + mit der bisherigen DOCBRIDGE-Schriftgröße. Überschreibt
   nur display/Zentrierung/Größe; Farben/Punkt/Padding kommen aus .hero-eyebrow. */
.docbridge-eyebrow {
  display: flex;              /* statt inline-flex → mit auto-Margin zentrierbar */
  width: fit-content;
  margin: 1.5rem auto 1rem;   /* horizontal zentriert + vertikaler Abstand */
  font-size: 0.85rem;         /* DOCBRIDGE-Schriftgröße beibehalten */
}

.docbridge-landing-headline {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0.5rem 0 1rem;
}

.docbridge-headline-accent {
  color: #1e8f4d;                          /* DTL-Grün signal */
}

.docbridge-landing-subtitle {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 2rem;
  color: #555;
  line-height: 1.6;
}

.docbridge-landing-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1023px) {
  .docbridge-landing-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
  .docbridge-landing-cards { grid-template-columns: 1fr; }
}

/* 0.5.221: Verwaltungs-Hub — Kacheln ZENTRIert. Das 4-Spalten-Raster der
   Landing ließ die Kacheln linksbündig; hier feste, inhaltsbreite Spalten
   + justify-content:center rückt die Gruppe in die Mitte.
   0.5.247: 4. Kachel „Schnittstellen" → eine Zeile mit 4 Spalten (etwas
   schmaler, damit sie auf Desktop nebeneinander passen). */
.docbridge-verwaltung .docbridge-landing-cards {
  grid-template-columns: repeat(4, minmax(0, 260px));
  justify-content: center;
}
@media (max-width: 1023px) {
  .docbridge-verwaltung .docbridge-landing-cards {
    grid-template-columns: repeat(2, minmax(0, 300px));
  }
}
@media (max-width: 639px) {
  .docbridge-verwaltung .docbridge-landing-cards {
    grid-template-columns: minmax(0, 340px);
  }
}

.docbridge-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 1.25rem;
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid #d4e5d8;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  text-align: left;
  font: inherit;
}

.docbridge-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.docbridge-card-icon { color: #1e5b34; }

.docbridge-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.docbridge-card-text {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

.docbridge-card-badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  background: #f7a30e;
  color: #fff;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  align-self: flex-end;
  margin-top: auto;
}
/* 0.5.220: Kurz-Status-Pille auf den Verwaltungs-Hub-Kacheln. margin-top:auto
   schiebt sie an den Kachel-Boden, damit die Kacheln trotz unterschiedlich
   langer Texte gleich „abschließen". Neutral = DTL-Grünton, -warn = Orange. */
.docbridge-card-status {
  display: inline-block;
  margin-top: auto;
  padding: 0.18em 0.6em;
  border-radius: 999px;
  background: #eef2f1;
  color: #1e5b34;
  font-size: 0.78rem;
  font-weight: 600;
}
.docbridge-card-status-warn {
  background: #fff3e0;
  color: #9a3412;
}

.docbridge-card-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.docbridge-card-disabled:hover {
  box-shadow: none;
  transform: none;
}

/* === Posteingang-Modal === */

.docbridge-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.docbridge-modal-backdrop[hidden] { display: none; }

.docbridge-modal {
  background: #fff;
  /* Refine-Modal-Redesign (2026-05-24): wider + dynamic. The previous
     720px was too tight for a table with checkbox / ampel / filename /
     kanal / action columns — long filenames truncated aggressively. */
  max-width: min(90vw, 900px);
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  /* P5.1 Followup — position: relative damit das Loading-Overlay
     (.docbridge-modal-loading-overlay, position: absolute) sich am
     Modal-Container ausrichtet, nicht am Viewport. */
  position: relative;
}

.docbridge-modal-header {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.docbridge-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  flex: 1;             /* nimmt restliche Breite — schiebt Check + Close nach rechts */
}

.docbridge-modal-header .docbridge-modal-master-check {
  margin-right: 0.5rem;
}

.docbridge-modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}

.docbridge-modal-body {
  padding: 1rem 1.5rem;
  overflow: auto;
  flex: 1;
}

.docbridge-modal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docbridge-modal-row {
  display: grid;
  grid-template-columns: 20px 140px 1fr 1fr 80px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.docbridge-modal-row:last-child { border-bottom: none; }

.docbridge-modal-link {
  text-align: right;
  text-decoration: none;
  color: #1e5b34;
  font-weight: 600;
}

.docbridge-modal-link:hover { text-decoration: underline; }

.docbridge-ampel {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.docbridge-ampel-gruen  { background: #2ec27e; }
.docbridge-ampel-gelb   { background: #f7a30e; }
.docbridge-ampel-orange { background: #ff8800; }
.docbridge-ampel-rot    { background: #d63838; }

.docbridge-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.docbridge-btn-secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  border: 1px solid #d4e5d8;
  background: #fff;
  color: #1e5b34;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.docbridge-btn-secondary:hover { background: #f3faf5; }

/* === Etappe C1 — Workspace 4-Spalten-Layout ============================== */
/*
 * The workspace lives at /docbridge/workspace and stretches the available
 * vertical space between portal-ribbon and footer. Columns are flex children
 * with explicit min-widths so the rendering never collapses; resize-handles
 * (.dbws-resize-handle) sit between adjacent columns and tweak the previous
 * sibling's flex-basis via the workspace.js drag handlers.
 */
.docbridge-workspace {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  /* 100px = Topbar + dbws-footer. Portal-Footer UND Portal-Ribbon sind
     auf der Workspace-Surface ausgeblendet (siehe workspace.html
     `{% block footer %}{% endblock %}` + `{% block ribbon %}{% endblock %}`)
     — Höhen ein zweites Mal nachgezogen. */
  min-height: calc(100vh - 100px);
  position: relative;
}
/* Stretch the column row so the columns actually fill the workspace
   height even though flex-wrap puts the footer onto its own line. */
.docbridge-workspace > .dbws-col,
.docbridge-workspace > .dbws-resize-handle {
  height: calc(100vh - 160px);
  min-height: 500px;
}
.dbws-col {
  display: flex;
  flex-direction: column;
  border: 1px solid #d4e5d8;
  background: #fff;
  overflow: hidden;
  min-width: 120px;
}
.dbws-col-baum       { flex: 0 0 220px; }
.dbws-col-viewer     { flex: 1 1 35%; min-width: 300px; }
.dbws-col-uebersicht { flex: 0 0 280px; }
.dbws-col-detail     { flex: 2 1 40%; min-width: 400px; overflow-y: auto; }
/* 0.5.364: Leistungsarten-Panel (5. Spalte, nur bei Positionsanalyse). */
.dbws-col-la         { flex: 1 1 26%; min-width: 240px; overflow-y: auto; }
.dbr-la-block { margin-bottom: 1rem; }
/* 0.5.365: Abschnitts-Titel wie die Spalten-Kopfzeile (.dbws-col-header). */
.dbr-la-sub {
  padding: 0.75rem 1rem;
  border-top: 1px solid #d4e5d8;
  border-bottom: 1px solid #d4e5d8;
  background: #f5fafb;
  font-size: 1rem; font-weight: 700; color: #1f3a29;
}
.dbr-la-row-missing { background: #fecaca; }
.dbr-la-row-missing td { color: #7f1d1d; }
/* 0.5.366: klappbare Auftragsposition — Kopfzeile (Titel + Beleg-Summe +
   Status) steht AUSSERHALB des eingerahmten, einklappbaren Bereichs (der
   die Leistungspositionen + je Position saldierte LA-Ansicht enthaelt). */
.dbr-la-pos { border-bottom: 1px solid #eef3ef; }
.dbr-la-pos-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; cursor: pointer; user-select: none; font-weight: 600;
}
.dbr-la-pos-head:hover { background: #f5fafb; }
.dbr-la-pos-chevron { color: #1e8f4d; font-size: 0.9rem; width: 1rem; text-align: center; }
.dbr-la-pos-title { flex: 1; min-width: 0; }
.dbr-la-pos-sum { font-variant-numeric: tabular-nums; color: #1f3a29; font-weight: 700; }
/* Status-Punkt grau (offen) / gruen (ok) am Positions-Kopf — wie die
   Pruef-Checkliste: gruen = Summe der zugeordneten LAs = Beleg-Summe. */
.dbr-la-pos[data-status="ok"] .dbr-pruef-dot { background: #22c55e; }
.dbr-la-pos[data-status="ok"] .dbr-pruef-status { color: #15803d; }
/* Der einklappbare Bereich (Leistungspositionen + saldiert) als eigener
   umrahmter Block, leicht eingerueckt -> Zugehoerigkeit zur Position sichtbar. */
.dbr-la-pos-body {
  margin: 0 0.5rem 0.6rem 1.1rem;
  border: 1px solid #d9e2dc;
  border-radius: 6px;
  overflow: hidden;
  background: #fbfdfc;
}
.dbr-la-sub-nested { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
/* Nach rechts eingerueckt — untergeordnet zu "Leistungspositionen". Die
   Tabellenzellen haben selbst schon 0.6rem Innenabstand (.dbr-positions td)
   — Wrap-Margin um genau diesen Betrag kleiner, damit der LA-Text exakt
   unter dem "Leistungsarten saldiert"-Text startet (2.5rem padding-left). */
.dbr-la-sub-saldiert { padding-left: 2.5rem; }
.dbr-la-saldiert-wrap { margin-left: 1.9rem; }
.dbr-la-sub-nested:not(:first-child) { border-top: 1px solid #d4e5d8; }
/* Summenzeile unter der je-Position-saldierten LA-Tabelle. */
.dbr-la-summe-row td { font-weight: 700; border-top: 2px solid #d4e5d8; }
.dbr-la-gesamt {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; margin-top: 0.5rem;
  border-top: 2px solid #d4e5d8; font-weight: 700;
}
.dbr-la-gesamt-label { flex: 1; min-width: 0; }
.dbr-la-gesamt-sum { font-variant-numeric: tabular-nums; }
/* Status-Punkt grau (offen) / gruen (ok) — exakt wie die Pruef-Checkliste. */
.dbr-la-gesamt[data-status="ok"] .dbr-pruef-dot { background: #22c55e; }
.dbr-la-gesamt[data-status="ok"] .dbr-pruef-status { color: #15803d; }
.dbws-resize-handle {
  flex: 0 0 4px;
  cursor: col-resize;
  background: #e0e0e0;
}
.dbws-resize-handle:hover { background: #1e8f4d; }
/* Transparent capture-layer during column drag — keeps mousemove/-up
   alive even when the cursor crosses the <object> PDF embed in col 2. */
.dbws-drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  cursor: col-resize;
  background: transparent;
}

.dbws-col-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #d4e5d8;
  background: #f5fafb;
}
.dbws-col-header h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.dbws-col-meta { margin: 0.25rem 0 0; font-size: 0.8rem; color: #666; }
/* Block-B Refine: Doc-Baum-Spalte hat eine Header-Row (Titel + Toggle-
   Button), die anderen Spalten lassen den Block ungenutzt. */
.dbws-col-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.dbws-col-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}
.dbws-col-toggle {
  background: transparent;
  border: 1px solid #d4e5d8;
  border-radius: 4px;
  padding: 0 0.45rem;
  height: 1.5rem;
  font-size: 0.95rem;
  line-height: 1;
  color: #1e8f4d;
  cursor: pointer;
}
.dbws-col-toggle:hover { background: #fff; }

/* === Doc-Baum (col 1) + Übersicht (col 3) — shared list-item styling. */
.dbws-doc-list,
.dbws-uebersicht-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}
.dbws-doc-item,
.dbws-uebersicht-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: inherit;
}
.dbws-doc-item:hover,
.dbws-uebersicht-item:hover { background: #f5fafb; }
.dbws-doc-item-active,
.dbws-uebersicht-item-active {
  background: #e6f4ea;
  font-weight: 600;
  border-left: 3px solid #1e8f4d;
}
.dbws-doc-name { flex: 1; word-break: break-word; }
/* Block-B Refine (Doc-Baum, Spalte 1):
   * Eine kompakte erste Zeile (Ampel + Filename als Ellipsis), darunter
     optional eine zweite Zeile mit Versender-Hinweis bzw. Sender-Mail.
   * Die folgenden Selektoren überschreiben das Default-Item-Layout aus
     dem Block oben (`display: flex` mit horizontal gap + wrap-Filename)
     gezielt nur innerhalb der Doc-Baum-Spalte. */
.dbws-col-baum .dbws-doc-item {
  display: block;
  padding: 0.4rem 0.6rem;
  line-height: 1.25;
}
.dbws-doc-line1 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  min-width: 0;
}
.dbws-col-baum .dbws-doc-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}
.dbws-doc-subtitle {
  display: block;
  margin: 0.1rem 0 0 1rem; /* hängt unter dem Filename, hinter dem Ampel-Dot */
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Collapsed-State der Doc-Baum-Spalte (Block-B Refine) ============== */
.dbws-col-collapsed-rail { display: none; }
.dbws-col-baum.is-collapsed {
  /* Override aller localStorage-/Default-Breiten — die Schmal-Rail ist
     ein eigener Zustand und ignoriert den expanded width-Wert (der bleibt
     in localStorage erhalten und kommt beim Ausklappen zurück). */
  flex: 0 0 36px !important;
  min-width: 0;
}
.dbws-col-baum.is-collapsed .dbws-col-header,
.dbws-col-baum.is-collapsed .dbws-doc-list {
  display: none;
}
.dbws-col-baum.is-collapsed .dbws-col-collapsed-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  cursor: pointer;
  flex: 1;
  background: #f5fafb;
}
.dbws-col-baum.is-collapsed .dbws-col-collapsed-rail:hover {
  background: #eaf6ed;
}
.dbws-col-collapsed-chevron {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e8f4d;
  line-height: 1;
}
.dbws-col-collapsed-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e8f4d;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
/* Resize-Handle gleich neben der kollabierten Spalte abschalten — sonst
   würde der Anwender die Schmal-Rail über das Handle wieder breit ziehen
   und das Toggle-Pattern kollidiert mit dem Drag-Pattern. */
.dbws-col-baum.is-collapsed + .dbws-resize-handle {
  display: none;
}
/* 0.5.173 — Generischer Spalten-Collapse für ALLE Spalten (Viewer/Übersicht/
   Detail), gleiches Verhalten wie der Doc-Baum: is-collapsed schrumpft die
   Spalte auf eine 36px-Rail, blendet alle Direktkinder außer der Rail aus und
   deaktiviert das benachbarte Resize-Handle. Die Rail trägt selbst das
   Expand-Affordance (data-action=toggle-col). */
.dbws-col.is-collapsed {
  flex: 0 0 36px !important;
  min-width: 0;
  overflow: hidden;
}
.dbws-col.is-collapsed > *:not(.dbws-col-collapsed-rail) {
  display: none !important;
}
.dbws-col.is-collapsed > .dbws-col-collapsed-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  cursor: pointer;
  flex: 1;
  background: #f5fafb;
}
.dbws-col.is-collapsed > .dbws-col-collapsed-rail:hover {
  background: #eaf6ed;
}
.dbws-col.is-collapsed + .dbws-resize-handle {
  display: none;
}

/* === Übersicht (Spalte 3, Block-C Refine) =========================
   Items sind 2-zeilig:
     Zeile 1: [● Ampel] "Sendung N"   [Status-Pille]
     Zeile 2: kleine, muted Detail-Zeile "Empfänger · X Teile · Y PS"
   Default-Item-Flex (display: flex + horizontal) wird gezielt nur in
   der Übersicht-Spalte überschrieben. */
.dbws-col-uebersicht .dbws-uebersicht-item {
  display: block;
  padding: 0.4rem 0.6rem;
  line-height: 1.3;
}
.dbws-uebersicht-line1 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  min-width: 0;
}
.dbws-uebersicht-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dbws-uebersicht-status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #eef3f7;
  color: #3f566e;
  white-space: nowrap;
  flex-shrink: 0;
}
.dbws-uebersicht-line2 {
  display: block;
  margin: 0.15rem 0 0 1rem; /* alignment unter dem Label, hinter dem Dot */
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* P1 Refactor — Hint-Banner in Col 3, wenn keine Feldmapping-Regel
   für den Versender vorhanden ist und nur die Roh-Struktur erkannt wurde. */
.dbws-raw-struct-hint {
  margin: 0.5rem 0.6rem 0.75rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid #f7a30e;
  background: #fffaef;
  border-radius: 4px;
  font-size: 0.8rem;
}
/* P5.1 Followup #4 — Header-Variante: Block sitzt ganz oben in der Spalte
   und beinhaltet den Spalten-Titel + Massen-Aktion-Trigger oberhalb der
   Hint-Info. Ersetzt das frühere Setup mit getrenntem <header> + Hint-Box
   plus „N Lieferungen in dem Auftragsdokument"-Zeile (entfernt). */
.dbws-raw-struct-hint-header {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-bottom: 1px solid #f3e3b3;
  padding: 0.75rem 1rem;
}
.dbws-raw-struct-hint-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dbws-raw-struct-hint-header .dbws-col-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}
.dbws-raw-struct-headline {
  margin: 0;
  font-weight: 700;
  color: #855a00;
}
.dbws-raw-struct-sub {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.75rem;
}
/* P3.3 Followup #13: Hinweis-Zeile zur Regel-Situation in 3 Varianten:
   no-rule (Emphasis: fett + größer, ruft zur Aktion auf),
   ausstehend (gelb, wartet auf Admin),
   aktiv (grün, alles gut). */
.dbws-raw-struct-sub-emphasis {
  font-size: 0.88rem;
  font-weight: 700;
  color: #855a00;
}
.dbws-raw-struct-sub-rule-pending {
  font-size: 0.85rem;
  font-weight: 600;
  color: #855a00;
}
.dbws-raw-struct-sub-rule-active {
  font-size: 0.85rem;
  font-weight: 600;
  color: #07502b;
}
.dbws-raw-struct-columns {
  margin: 0.4rem 0 0;
  color: #4b5563;
  font-size: 0.7rem;
  word-break: break-word;
  /* 0.5.177: genug Zeilenhöhe, damit die umrandeten Spalten-Chips beim
     Umbruch nicht vertikal überlappen. */
  line-height: 1.9;
}
.dbws-raw-struct-columns code {
  background: #fff;
  border: 1px solid #f3e3b3;
  border-radius: 3px;
  padding: 0 0.25rem;
  font-family: inherit;
}
/* P3.1 — Status-Marker pro Roh-Spalte (Tooltip via title= im Markup).
   neutral = default (wie .dbws-raw-struct-columns code)
   temporary = gelb (User hat via Assistent ein temporäres Mapping gesetzt)
   rule_saved = grün (Mapping ist als docbridge_regel persistiert) */
.dbws-raw-col {
  background: #fff;
  border: 1px solid #f3e3b3;
  border-radius: 3px;
  /* 0.5.177: kleine vertikale Polsterung + inline-block, damit die Chips
     sauber umbrechen und nicht überlappen. */
  padding: 0.08rem 0.3rem;
  display: inline-block;
  font-family: inherit;
  cursor: help;
}
/* P3.3 Followup #11: doppelte Selektoren um die Specificity der älteren
   `.dbws-raw-struct-columns code` Regel (oben definiert) zu überstimmen.
   Diese hatte 0,1,1-Specificity (class + element), unsere Mod-Klassen
   nur 0,1,0 → Cascade-Loss bei gleicher Hierarchie. Mit dem doppelten
   Selektor erreichen wir Parität bzw. Vorrang. */
.dbws-raw-col-temporary,
.dbws-raw-struct-columns code.dbws-raw-col-temporary {
  background: #fff3c4;
  border-color: #d4a017;
  font-weight: 600;
}
/* Etappe 3 (0.5.37) — Drei-Status-Schema für Roh-Spalten:
   - temporary    = GELB  (gemappt, aber rule_intent='once' → keine Regel)
   - rule_pending = BLAU  (rule_id gesetzt, Regel.status='ausstehend',
                            Admin muss noch bestätigen)
   - rule_active  = GRÜN  (rule_id gesetzt, Regel.status='aktiv' —
                            vom Admin freigegeben)
   `rule_saved` als Klasse bleibt als Backward-Compat-Alias auf rule_active,
   falls noch alte payloads ankommen wo der Status-Resolver bypassed
   wurde — sollte in 0.5.37+ aber gar nicht mehr ausgegeben werden. */
.dbws-raw-col-rule_active,
.dbws-raw-col-rule_saved,
.dbws-raw-struct-columns code.dbws-raw-col-rule_active,
.dbws-raw-struct-columns code.dbws-raw-col-rule_saved {
  background: #d2f3dd;
  border-color: #2ec27e;
  color: #07502b;
  font-weight: 700;
}
.dbws-raw-col-rule_pending,
.dbws-raw-struct-columns code.dbws-raw-col-rule_pending {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 700;
}
/* 0.5.239 (Layout-Drift Phase 2): neue Spalte — rot blinkende Chip-Markierung
   + roter Warnhinweis im Header. Doppel-Selektor für Specificity-Parität zur
   älteren `.dbws-raw-struct-columns code`-Regel. */
@keyframes dbws-col-blink {
  0%, 100% { background: #fde8e8; border-color: #dc2626; color: #991b1b; }
  50%      { background: #dc2626; border-color: #b91c1c; color: #fff; }
}
.dbws-raw-col-new,
.dbws-raw-struct-columns code.dbws-raw-col-new {
  background: #fde8e8;
  border-color: #dc2626;
  color: #991b1b;
  font-weight: 700;
  animation: dbws-col-blink 1.1s ease-in-out infinite;
}
/* 0.5.240: Warnhinweis dezent (nicht blinkend) — gleiche weiche Rot-Palette
   wie die übrigen Fehlermeldungen (red-50/200/700). Nur die Spalten-Chips
   blinken. */
.dbws-raw-struct-new-warning {
  margin: 0.4rem 0;
  padding: 0.4rem 0.7rem;
  border-radius: 0.375rem;
  background: #fef2f2;          /* red-50 */
  border: 1px solid #fecaca;    /* red-200 */
  color: #b91c1c;               /* red-700 */
  font-weight: 600;
  font-size: 0.85rem;
}
.dbws-new-col-list { font-weight: 800; }
/* 0.5.241: „ignorieren"-Link je neuer Spalte im Warnhinweis. */
.dbws-new-col-item { white-space: nowrap; }
.dbws-ignore-link {
  color: #b91c1c;
  text-decoration: underline;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
}
.dbws-ignore-link:hover { color: #7f1d1d; }
/* Bewegungsreduktion respektieren — dann statisch rot statt blinkend (Chips). */
@media (prefers-reduced-motion: reduce) {
  .dbws-raw-col-new,
  .dbws-raw-struct-columns code.dbws-raw-col-new { animation: none; }
}

/* P3.1 — Mini-Section-Header zwischen dem KI-Hint-Block und dem Grid.
   Trennt visuell und zeigt den Mapping-Fortschritt. */
.dbws-grid-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: #f5fafb;
  border-bottom: 1px solid #d4e5d8;
}
.dbws-grid-section-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f2937;
}
.dbws-grid-section-progress {
  font-size: 0.72rem;
  color: #6b7280;
}
.dbws-grid-section-progress-empty {
  color: #855a00;
  font-style: italic;
}
.dbws-grid-section-progress-complete {
  color: #07502b;
  font-weight: 600;
}

/* 0.5.150 — Pflicht-Segment-Ampel im Grid-Header (ersetzt den Text-Zähler).
   Je Block ein Segment grün/gelb/rot mit CSS-only Tooltip (CSP-sicher,
   kein JS — Vorlage dbws-grid-pool-bc-tooltip). */
.dbws-pflicht-ampel {
  display: inline-flex;
  gap: 3px;
  align-items: stretch;
}
.dbws-pflicht-seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 4px;
  cursor: help;
  outline: none;
  border: 1px solid transparent;
}
.dbws-pflicht-seg-label { white-space: nowrap; }
.dbws-pflicht-seg-gruen { background: #bbf7d0; color: #07502b; border-color: #86efac; }
.dbws-pflicht-seg-gelb  { background: #fde68a; color: #854d0e; border-color: #fcd34d; }
.dbws-pflicht-seg-rot   { background: #fecaca; color: #7f1d1d; border-color: #fca5a5; }
/* 0.5.364: LA-Pflichtfeld-Chip nur bei aktiver Positionsanalyse (Scope). */
.dbr-pflicht-seg-hidden { display: none; }
.dbws-pflicht-seg:focus-visible { box-shadow: 0 0 0 2px #2563eb; }
.dbws-pflicht-tooltip {
  display: none;
  position: absolute;
  z-index: 50;
  /* 0.5.151: nach LINKS öffnen statt rechts — die Ampel sitzt am rechten
     Rand des Headers, mit left:0 lief der Tooltip aus dem sichtbaren Bereich
     (rechts abgeschnitten, unlesbar). right:0 verankert die rechte Kante am
     Segment, der Tooltip wächst nach links in die Spalte. */
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 14rem;
  max-width: 24rem;
  padding: 0.5rem 0.7rem;
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  white-space: normal;
  pointer-events: none;
}
.dbws-pflicht-seg:hover .dbws-pflicht-tooltip,
.dbws-pflicht-seg:focus-within .dbws-pflicht-tooltip,
.dbws-pflicht-seg:focus .dbws-pflicht-tooltip {
  display: block;
}

/* P3.1 — Mapping-Grid in Spalte 3. Tabelle mit horizontalem Scroll wenn die
   10 Zielfeld-Spalten breiter werden als die Workspace-Spalte. */
/* 0.5.207: Banner — unbekannte Warengruppe stoppt die Automatik. Rot/Warnung,
   benennt die nicht zugeordnete Teileart + Menge und verweist auf den Chat-
   Assistenten zur Regel-Erstellung. */
.dbws-hw-unmapped-banner {
  margin: 0 0.75rem 0.5rem 0.75rem;
  padding: 0.6rem 0.9rem;
  background-color: #fee2e2;              /* red-100 */
  border: 1px solid #fca5a5;             /* red-300 */
  border-left: 4px solid #dc2626;        /* red-600 */
  border-radius: 6px;
  color: #7f1d1d;                        /* red-900 */
  font-size: 0.8rem;
  line-height: 1.4;
}
.dbws-hw-unmapped-banner strong {
  font-weight: 600;
}
.dbws-hw-unmapped-cats {
  font-weight: 600;
}

.dbws-grid-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  background: #fff;
}
.dbws-grid {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.78rem;
}
.dbws-grid thead {
  position: sticky;
  top: 0;
  background: #f5fafb;
  z-index: 2;
}
.dbws-grid th, .dbws-grid td {
  border: 1px solid #d4e5d8;
  padding: 0.3rem 0.5rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}
.dbws-grid-th {
  font-weight: 700;
  color: #1f2937;
}
/* 0.5.89: Numerische Spalten (HW-Gruppen, Teile/Bügel, Anzahl-Pakete,
   Gewicht) rechtsbündig — entspricht klassischer Zahlen-Konvention,
   visuell sind die Werte direkt vergleichbar. String-Spalten bleiben
   linksbündig (Default).
   0.5.90: Selektoren spezifischer — die generische Regel
   .dbws-grid th/td (Z. ~6461) setzt text-align:left mit Spezifität
   0-1-1 und schlägt unsere bisherigen .dbws-grid-td-numeric-Regel
   (0-1-0) per Spezifität. Mit th/td-Element-Selektor davor sind wir
   bei 0-2-1 und gewinnen. */
.dbws-grid th.dbws-grid-th-numeric,
.dbws-grid td.dbws-grid-td-numeric {
  text-align: right;
}
.dbws-grid-th-required {
  background: #fffaef;     /* gelblicher Hintergrund signalisiert "Pflicht" */
  border-bottom: 2px solid #f7a30e;
}
/* P3.3 Followup — Abkürzung neben dem Header-Label, kleiner und muted.
   Der Anwender kann die Abk im Assistent-Chat als Kurzform nutzen
   ("IdentNr → TR" statt "IdentNr → Tracking-Referenz"). */
.dbws-grid-th-abk {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6d28d9;
  background: #f3eafd;
  border: 1px solid #d8c0f5;
  border-radius: 3px;
  padding: 0 0.25rem;
}
.dbws-grid-th-conditional {
  background: #f5fafb;
  border-bottom: 2px solid #93c5fd;
}
.dbws-grid-rowindex {
  background: #f5fafb;
  text-align: center;
  font-weight: 700;
  color: #6b7280;
  width: 2rem;
}
.dbws-grid-td-empty {
  background: #fcfcfc;
  color: #cbd5e1;          /* leichter Strich-Indikator — Zelle bewusst leer */
}
.dbws-grid-td-empty:before {
  content: "–";
}
/* Etappe 3 (0.5.36) — Konstanten-Spalte: der Wert kommt nicht aus einer
   Roh-Spalte, sondern pauschal aus dem Chat ("setze Frkt konstant auf DDP").
   Italic + dezenter grüner Tint signalisiert dem Anwender, dass diese
   Zelle nicht vom PDF stammt. Header bekommt zusätzlich eine kleine Pill
   "konstant" neben der Abk. */
.dbws-grid-td-constant {
  font-style: italic;
  color: #1f6f3f;
  background: #f0f9f3;
}
.dbws-grid-th-constant {
  background: #f0f9f3;
  border-bottom: 2px solid #1f6f3f;
}
.dbws-grid-th-const-pill {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1f6f3f;
  background: #d6efe0;
  border: 1px solid #9bd3b1;
  border-radius: 3px;
  padding: 0 0.3rem;
  vertical-align: middle;
}

/* 0.5.113: Pool-generierter Master-BC in der TR-Spalte.
   - Zellen-Hintergrund hell-blau (vom Versender-/Konstanten-Grün
     abgegrenzt damit Anwender erkennt: dieser Wert kommt aus dem
     Nummernkreis-Pool, nicht aus dem Dokument).
   - Monospace damit die BC-Ziffern bündig stehen und Mod-10-Prüfziffer
     visuell als letzte Stelle erkennbar bleibt.
   - position:relative + Tooltip-Mechanik: das innere div
     .dbws-grid-pool-bc-tooltip ist default hidden (display:none) und
     erscheint per :hover/:focus-within auf der TD. CSS-only, kein JS,
     kein CSP-Inline-Style-Risiko.
   - Tooltip-Inhalt ist eine Liste "<BC>  Master: …" Zeilen, jede in
     eigenem div damit Wrap-Verhalten lesbar bleibt. */
.dbws-grid-td-pool-bc {
  position: relative;
  background: #eaf3fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: help;
}
.dbws-grid-td-pool-bc .dbws-grid-pool-bc-value {
  font-variant-numeric: tabular-nums;
}
.dbws-grid-pool-bc-tooltip {
  display: none;
  position: absolute;
  z-index: 50;
  left: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 22rem;
  max-width: 32rem;
  padding: 0.55rem 0.75rem;
  background: #1f2937;
  color: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  pointer-events: none;
}
.dbws-grid-td-pool-bc:hover .dbws-grid-pool-bc-tooltip,
.dbws-grid-td-pool-bc:focus-within .dbws-grid-pool-bc-tooltip {
  display: block;
}
.dbws-grid-pool-bc-tooltip-line {
  padding: 0.05rem 0;
}
.dbws-grid-pool-bc-tooltip-line:first-child {
  color: #fde68a;
  font-weight: 600;
}
/* 0.5.163 — Grid-Zeile als Auswahl für die read-only Detail-Maske
   (Spalte 4). Das Grid bleibt read-only; der Klick wählt nur aus. */
.dbws-grid-row {
  cursor: pointer;
}
.dbws-grid tbody tr.dbws-grid-row:hover {
  background: #f5f3ff;
}
.dbws-grid tbody tr.dbws-grid-row-selected {
  background: #ede9fe;
  box-shadow: inset 3px 0 0 0 #6d28d9;
}
.dbws-grid tbody tr.dbws-grid-row-selected td {
  font-weight: 600;
}
/* P5.2 — KI-Token-Anzeige am unteren Banner-Rand */
.dbws-raw-struct-ai {
  margin: 0.45rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px dashed #f3e3b3;
  font-size: 0.7rem;
  color: #4b5563;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}
.dbws-raw-struct-ai-badge {
  background: #6d28d9;
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}

/* 0.5.92: Spinner-Animation für die Auto-Suggest-Lade-Anzeige.
   Genutzt vom Assistent-Button (kleiner Spinner rechts daneben) und
   vom Hint-Banner (vor dem "KI analysiert die Spalten…"-Text). Lila
   passt zum Workspace-KI-Bubble-Lila aus 0.5.77/0.5.80. */
@keyframes dbws-spin {
  to { transform: rotate(360deg); }
}
.dbws-prompt-trigger-spinner,
.dbws-spinner-inline {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid #6d28d9;
  border-top-color: transparent;
  border-radius: 50%;
  animation: dbws-spin 0.8s linear infinite;
  vertical-align: middle;
}
.dbws-prompt-trigger-spinner {
  margin-left: 0.4rem;
}
.dbws-spinner-inline {
  margin-right: 0.4rem;
}
.dbws-raw-struct-sub-auto-suggest {
  /* Hint-Banner während Auto-Suggest läuft. Selber Stil wie der
     "Keine genehmigte Mapping-Regel"-Banner aber lila statt orange,
     damit visuell klar ist: hier passiert was, einfach warten. */
  color: #4b5563;
  font-style: italic;
}
/* 0.5.80: Drei-Pfad-Badge in der KI-Bubble in Spalte 3 — analog zum
   Posteingang-Modal-Badge aus 0.5.79. Same Größen/Padding wie
   .dbws-raw-struct-ai-badge, nur die Hintergrundfarbe variiert je Pfad. */
.dbws-raw-struct-path-badge {
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}
.dbws-raw-struct-path-pdf {
  background: #10b981;
}
.dbws-raw-struct-path-ki {
  background: #6d28d9;
}
.dbws-raw-struct-path-ki-ocr {
  background: #581c87;
}
.dbws-raw-struct-ai code {
  background: #fff;
  border: 1px solid #e5d8f5;
  border-radius: 3px;
  padding: 0 0.3rem;
  font-family: inherit;
}
.dbws-raw-struct-ai-ct {
  color: #6b7280;
  font-size: 0.68rem;
}

/* P5.1 Followup #3 — KI-Badge im Posteingang-Modal hinter dem Filename.
   Klein, lila wie der Hint-Banner-Badge im Workspace, mit Tooltip via
   title-Attribut. Erscheint nur wenn payload.raw_structure.parser_used
   startet mit "claude-".
   0.5.79: Bleibt als Legacy-Klasse (falls noch irgendwo referenziert),
   ersetzt durch .docbridge-modal-doc-path-badge + Modifier unten. */
.docbridge-modal-doc-ai-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  background: #6d28d9;
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: help;
}

/* 0.5.79: Drei-Pfad-Badge im Posteingang-Modal — ersetzt das binäre
   KI-Badge aus 0.5.1. Basis-Klasse + drei Modifier (PDF/KI/KI·OCR). */
.docbridge-modal-doc-path-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: help;
  white-space: nowrap;
}
.docbridge-modal-doc-path-eingang {
  /* 0.5.89: Vierter Typ — Doc liegt im Eingang, noch nicht verarbeitet.
     Neutrales Grau damit es klar von den drei Verarbeitungs-Pfaden
     (PDF/KI/KI·OCR) unterscheidbar bleibt. */
  background: #9ca3af;
}
.docbridge-modal-doc-path-pdf {
  /* Pfad A — deterministisch, kein KI-Aufwand. Neutral-grün als
     "alles entspannt"-Signal. */
  background: #10b981;
}
.docbridge-modal-doc-path-ki {
  /* Pfad B — KI mit Text-Layer (type=document). Lila wie das alte
     ai-badge — Anwender erkennt KI sofort. */
  background: #6d28d9;
}
.docbridge-modal-doc-path-ki-ocr {
  /* Pfad C — KI mit OCR (type=image, 400-DPI-PNG). Lila wie KI,
     plus "· OCR"-Suffix im Text als visueller Unterschied.
     Etwas anderer Lila-Ton (dunkler) damit es zusätzlich differenziert. */
  background: #581c87;
}

/* 0.5.258: Dokumenttyp-Badge (geteilt: Posteingang-Modal, /inbox, Archiv —
   gerendert über das Macro templates/docbridge/_doktyp_badge.html). Bewusst
   ein WEICH GETÖNTES Identitäts-Tag (heller BG + farbiger Text/Rand + Icon),
   damit es sich klar von den SOLIDEN Verarbeitungs-Pfad-Badges (PDF/KI/OCR)
   in derselben Zeile abhebt — "WAS für ein Dokument" vs. "WIE verarbeitet".
   Icon erbt die Textfarbe (stroke=currentColor). */
.docbridge-doktyp-badge {
  /* 0.5.259: Nur-Icon-Darstellung, an erster Stelle der Zeile (vor dem
     Dateinamen) → runder Chip mit symmetrischem Padding + Abstand nach
     rechts. Der Dokumenttyp steht im title-Tooltip. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-right: 0.4rem;
  padding: 0.13rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 0;
  cursor: help;
}
.docbridge-doktyp-badge-icon { flex: 0 0 auto; display: block; }
.docbridge-doktyp-badge--auftrag {
  background: #eff6ff;   /* blue-50  */
  color: #1d4ed8;        /* blue-700 */
  border-color: #bfdbfe; /* blue-200 */
}
.docbridge-doktyp-badge--rechnung {
  background: #f5f3ff;   /* violet-50  */
  color: #6d28d9;        /* violet-700 */
  border-color: #ddd6fe; /* violet-200 */
}
.docbridge-doktyp-badge--unbestimmt {
  background: #f3f4f6;   /* gray-100 */
  color: #6b7280;        /* gray-500 */
  border-color: #e5e7eb; /* gray-200 */
}

/* P5.1 Followup — Loading-Overlay über dem Posteingang-Modal während
   Bulk-Verarbeiten läuft. KI-OCR braucht pro Scan-PDF 5-15 s, der
   Anwender muss sehen dass was passiert. */
.docbridge-modal-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}
.docbridge-modal-loading-card {
  text-align: center;
  padding: 1.5rem 2rem;
  max-width: 32rem;
}
.docbridge-modal-loading-spinner {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border: 4px solid #d4e5d8;
  border-top-color: #1e8f4d;
  border-radius: 50%;
  animation: docbridge-spin 0.9s linear infinite;
}
@keyframes docbridge-spin {
  to { transform: rotate(360deg); }
}
.docbridge-modal-loading-title {
  margin: 0;
  font-weight: 700;
  color: #1f2937;
  font-size: 1rem;
}
.docbridge-modal-loading-sub {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.dbws-doc-meta,
.dbws-uebersicht-empf {
  font-size: 0.8rem;
  color: #777;
}
.dbws-uebersicht-bc { flex: 1; font-family: ui-monospace, Menlo, monospace; }

/* === Ampel-Dots (reused for both Doc-rollup and per-Auftrag rows). */
.dbws-ampel {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dbws-ampel-gruen  { background: #2ec27e; }
.dbws-ampel-gelb   { background: #f7a30e; }
.dbws-ampel-orange { background: #ff8800; }
.dbws-ampel-rot    { background: #d63838; }
/* 0.5.164 — größere Ampel in der Detail-Masken-Kopfzeile (Doc-Status). */
.dbws-ampel-lg { width: 16px; height: 16px; border: 1px solid rgba(0,0,0,0.15); }
/* Detail-Masken-Kopfzeile: Titel links, Ampel rechts. */
.dbws-col-detail .dbws-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  /* 0.5.166: Platz rechts für einen künftigen Einklapp-Button reserviert. */
  padding-right: 2.25rem;
}
/* 0.5.174 — Viewer-Kopf wie die anderen Spalten als Flex-Zeile: Titel links,
   Icons (Popout + Einklappen) rechts auf DERSELBEN Zeile (vorher umgebrochen).
   Langer Dateiname wird per Ellipsis gekürzt statt die Icons zu verdrängen. */
.dbws-col-viewer .dbws-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.dbws-col-viewer .dbws-col-header h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dbws-col-viewer .dbws-viewer-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  float: none;
}
/* 0.5.164 — 3-Spalten-Auftragslegende (Versender | Empfänger | Auftragsdaten)
   im Sendungsverfolgungs-Stil. Reused .auftrag-col / .auftrag-row. */
.dbws-auftrag-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}
@media (min-width: 768px) {
  .dbws-auftrag-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === Viewer (col 2). */
.dbws-viewer-toolbar { float: right; }
.dbws-btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2em 0.4em;
  font-size: 1.1rem;
  color: #1e5b34;
}
.dbws-btn-icon:hover {
  background: #e6f4ea;
  border-radius: 0.2rem;
}
.dbws-viewer-body {
  flex: 1;
  overflow: hidden;
  display: flex;
}
.dbws-pdf-embed {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 0;
}
/* 0.5.98: Excel-Viewer als iframe in der Viewer-Spalte. Selbe Größe
   wie der PDF-Embed; das eingebettete HTML-Doc bringt eigene Styles
   mit (siehe auftrag_quelldokument_excel_html). */
.dbws-excel-embed {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 0;
  background: #fcfcfd;
}

/* === Detail (col 4) — Sendungsmaske-Stil-Sektionen. */
.dbws-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
}
.dbws-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}
.dbws-section h4 {
  margin: 0.6rem 0 0.3rem;
  font-size: 0.85rem;
  color: #1e5b34;
}
.dbws-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #2ec27e;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}
.dbws-kopf-grid {
  display: grid;
  gap: 0.4em 1.5em;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  font-size: 0.9rem;
}
/* 0.5.165 — Detail-Masken-Kopf: Überschrift links, Eingangskanal + Doc-
   Status-Ampel rechtsbündig; rechts Platz für einen künftigen Einklapp-
   Button. Audit-Felder darunter in EINER Spalte (gestapelt). */
.dbws-section-kopf .dbws-kopf-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* Platz rechts für den geplanten Einklapp-Button. */
  padding-right: 2.25rem;
}
.dbws-section-kopf .dbws-kopf-head h3 {
  margin: 0;
}
.dbws-kopf-head-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.dbws-kopf-eingang {
  font-size: 0.85rem;
  color: #4b5563;
}
.dbws-kopf-list {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  font-size: 0.9rem;
}
/* 0.5.168 — Datum + BU wieder in EINER Zeile (User-Wunsch 'BU hinter Datum'). */
.dbws-kopf-row-inline {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
/* 0.5.168 — Der GANZE Auftrag-Block ist EIN durchgehender farbiger Kasten:
   Kopf-Balken + Audit-Felder teilen denselben Hintergrund, kein Trenner
   dazwischen (User: 'eine Spalte/Block als Ganzes'). */
.dbws-col-detail .dbws-col-header {
  border-bottom: 0;
}
.dbws-section-kopf {
  background: #f5fafb;
  /* bündig zum Kopf-Balken (padding-left 1rem), oben direkt anschließend. */
  padding: 0.35rem 1rem 0.85rem;
}
/* Mehrzeilige Referenz/Bemerkung — eine Zeile pro Referenz (Werte mit
   '\n' getrennt; pre-line rendert sie als echte Zeilenumbrüche). */
[data-detail-field="referenz"],
[data-detail-field="bemerkung"] {
  white-space: pre-line;
}
.dbws-legende-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 1023px) {
  .dbws-legende-grid { grid-template-columns: 1fr; }
}
.dbws-card {
  background: #f5fafb;
  border: 1px solid #d4e5d8;
  padding: 0.75rem 1rem;
  border-radius: 0.3rem;
}
.dbws-card header { margin-bottom: 0.4rem; }
.dbws-card dl {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.2em 0.6em;
  margin: 0;
  font-size: 0.85rem;
}
.dbws-card dt { color: #666; }
.dbws-card dd { margin: 0; font-weight: 600; }

/* 0.5.172 — ③ Mengenlegende + ④ Packstückliste nebeneinander (eine
   Zeilenebene) statt gestapelt: Mengenlegende links (fit-content),
   Packstückliste rechts (wachsend). Bricht auf schmalen Viewports um. Die
   gemeinsame untere Trennlinie sitzt auf der Zeile, nicht je Section. */
.dbws-mengen-pck-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  align-items: flex-start;
  border-bottom: 1px solid #f0f0f0;
}
.dbws-mengen-pck-row > .dbws-section {
  border-bottom: 0;
}
.dbws-mengen-pck-row > .dbws-section-mengen { flex: 0 1 auto; }
.dbws-mengen-pck-row > .dbws-section-pck { flex: 1 1 360px; min-width: 300px; }
.dbws-mengen-block { margin-bottom: 0.5rem; }
/* 0.5.180 — kleiner Abstand zwischen dem Label ('Hängeware:'/'Packstücke:')
   und der ersten Pille (die Pillen haben keinen linken Rand). */
.dbws-mengen-block strong { margin-right: 0.45rem; }
.dbws-pill {
  display: inline-block;
  padding: 0.15em 0.6em;
  margin: 0 0.3em 0.3em 0;
  background: #e6f4ea;
  color: #1e5b34;
  border-radius: 0.3em;
  font-size: 0.85rem;
  font-weight: 600;
}

.dbws-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.dbws-table th,
.dbws-table td {
  padding: 0.4em 0.6em;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.dbws-table thead { background: #f5fafb; }

.dbws-ref-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.dbws-ref-list li {
  padding: 0.3em 0;
  border-bottom: 1px dotted #eee;
}

/* === Footer — Sammel-Freigabe. */
.dbws-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #d4e5d8;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  /* Stretch the footer across the full workspace below the column row.
     The .docbridge-workspace flex container makes this footer a flex-item
     itself; flex-basis 100% pushes it to its own line below the columns. */
  flex: 0 0 100%;
}
.dbws-footer-info {
  flex: 1;
  font-size: 0.9rem;
  color: #555;
}

/* === Workspace C2 — Editable fields, source-tooltips, picker, footer ===
 * Etappe C2 (2026-05-23): the workspace's Col 4 becomes a live editing
 * surface. AJAX-state-classes paint the field-wrapper border on save
 * progress (.dbws-field-saving = orange, -saved = green, -invalid = red,
 * -required-empty = red for empty mandatory fields). The picker modal
 * uses a fixed-position backdrop + a centred white pane.
 */
.dbws-field {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  margin: 0.4em 0;
}
.dbws-field label {
  font-size: 0.8rem;
  color: #555;
}
.dbws-field input,
.dbws-field select {
  padding: 0.4em 0.6em;
  border: 1px solid #ccc;
  border-radius: 0.25em;
  font-size: 0.9rem;
  background: #fff;
}
/* 0.5.163 — Read-only Anzeigefeld in der Detail-Maske (kein Input). */
.dbws-field-readonly .dbws-field-value {
  padding: 0.4em 0.6em;
  border: 1px solid #eee;
  border-radius: 0.25em;
  font-size: 0.9rem;
  background: #fafafa;
  color: #1f2937;
  min-height: 1.2em;
}
/* 0.5.163 — Adress-Anzeigeblock (read-only) in den Versender-/Empfänger-
   Karten. Eine Zeile pro Komponente; leere Zeilen werden per [hidden]
   (JS) ausgeblendet. */
.dbws-address-display {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  font-size: 0.9rem;
  color: #1f2937;
  line-height: 1.35;
}
.dbws-address-display .dbws-address-line[hidden] {
  display: none;
}
.dbws-field-required label::after {
  content: "";
}
.dbws-field-required-empty input,
.dbws-field-required-empty select {
  border-color: #d63838;
  background: #fff5f5;
}
.dbws-field-saving input,
.dbws-field-saving select {
  border-color: #f7a30e;
}
.dbws-field-saved input,
.dbws-field-saved select {
  border-color: #2ec27e;
  background: #f0faf3;
}
.dbws-field-invalid input,
.dbws-field-invalid select {
  border-color: #d63838;
  background: #fff5f5;
}
.dbws-source-tooltip {
  color: #888;
  cursor: help;
  font-size: 0.85rem;
  margin-left: 0.3em;
}

/* Picker-Adornment: matchcode-input + Lupen-Button als horizontale Gruppe.
   align-items: end hält den Button unter dem Label-Baseline des inputs. */
.dbws-field-with-picker {
  display: flex;
  align-items: end;
  gap: 0.4em;
}
.dbws-field-with-picker .dbws-field {
  flex: 1;
}
.dbws-warenwert-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.6em;
}

/* Pro-Auftrag-Footer (innerhalb Col 4) — Freigeben + Verwerfen Side-by-Side. */
.dbws-detail-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #d4e5d8;
  display: flex;
  gap: 0.6em;
  background: #fafafa;
}
.dbws-detail-form {
  display: inline;
  margin: 0;
}

/* Picker-Modal: fixed-position backdrop, centred dialog. z-index 1100
   schiebt das Modal über die Header/Nav-Leiste (z 1000) ohne die session-
   warning-overlays (z 1200+) zu verdecken. */
.dbws-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.dbws-picker-backdrop[hidden] {
  display: none;
}
.dbws-picker {
  background: #fff;
  max-width: 600px;
  width: calc(100% - 2rem);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}
.dbws-picker-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dbws-picker-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.dbws-picker-search {
  padding: 0.75rem 1.25rem;
  display: flex;
  gap: 0.5em;
  border-bottom: 1px solid #eee;
}
.dbws-picker-search input {
  flex: 1;
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 0.25em;
}
.dbws-picker-results {
  padding: 0.5rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.dbws-picker-results ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dbws-picker-results li {
  border-bottom: 1px solid #f0f0f0;
}
.dbws-picker-result {
  width: 100%;
  text-align: left;
  padding: 0.6em 0.4em;
  background: none;
  border: 0;
  cursor: pointer;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.3em 0.6em;
}
.dbws-picker-result:hover {
  background: #f5fafb;
}
.dbws-picker-result small {
  color: #888;
  grid-column: 2;
}

/* === Workspace Etappe C3: Floating-Prompt Modal === */
/* Massen-Aktion + Regel-Erstellung. Style mirrors the picker modal so
   the two surfaces feel like siblings — same backdrop colour, same
   header / body / footer rhythm, same rounded card shell. */
.dbws-prompt-backdrop {
  position: fixed;
  inset: 0;
  /* 0.5.274: NICHT-blockierend. Kein dunkles Overlay mehr, und
     pointer-events:none laesst Klicks zum Workspace durch — der Anwender kann
     das Assistent-Fenster offen lassen und im Hintergrund weiterarbeiten
     (Positionen verschieben, Ansichten wechseln). Das Panel selbst setzt
     pointer-events:auto (siehe .dbws-prompt). Oeffnet rechts (flex-end),
     damit der Workspace links sichtbar/bedienbar bleibt. Geteilte Komponente
     → kommt Auftrag UND Rechnung zugute. */
  background: transparent;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem;
  z-index: 1200;
}
.dbws-prompt-backdrop[hidden] {
  display: none;
}
.dbws-prompt {
  background: #fff;
  /* 0.5.274: Panel bleibt interaktiv, obwohl der Backdrop pointer-events:none
     ist (Klicks im Leerbereich gehen an den Workspace durch). */
  pointer-events: auto;
  max-width: 560px;
  width: calc(100% - 2rem);
  display: flex;
  flex-direction: column;
  /* Etappe 3 (0.5.41): User-Wunsch — Ecken stärker abgerundet. */
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}
/* P3.2 — Chat-Variante des Modals: breiter + höher für den Chat-Verlauf.
   Resizable (native CSS resize-Handle in der Bottom-Right-Ecke) und
   draggable (JS-Handler auf [data-chat-drag-handle]). Initial bleibt
   das Modal flex-zentriert via Backdrop; beim ersten Drag wechselt JS
   auf position:fixed mit absoluten Koordinaten. */
.dbws-prompt-chat {
  max-width: none;
  width: min(800px, 70vw);
  height: 80vh;
  max-height: 90vh;
  min-width: 480px;
  min-height: 400px;
  resize: both;
  overflow: hidden;
}
.dbws-prompt-header-draggable {
  cursor: move;
  user-select: none;
  background: #fffaef;
  border-bottom: 1px solid #f3e3b3;
}
/* Buttons im draggable Header bleiben klickbar (kein Drag-Trigger) */
.dbws-prompt-header-draggable button {
  cursor: pointer;
}
.dbws-prompt-title-main {
  font-weight: 700;
  display: block;
}
.dbws-prompt-title-sub {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 400;
  display: block;
  margin-top: 0.1rem;
  word-break: break-all;
}
/* 0.5.77: KI-Stats-Box im Chat-Modal-Header — visuell konsistent mit der
   KI-Zeile in Spalte 3 (.dbws-raw-struct-ai). Strukturiertes Markup mit
   Badge (.dbws-raw-struct-ai-badge), Model-Code, Punkt-Trenner, Token-/
   Kosten-Text und ct-Span (.dbws-raw-struct-ai-ct). Sitzt inline-rechts
   im Header, daher kein Border-Top wie das Workspace-Pendant. */
.dbws-chat-stats {
  font-size: 0.7rem;
  color: #4b5563;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  padding-right: 0.5rem;
  overflow: hidden;
}
.dbws-chat-stats > code {
  background: #fff;
  border: 1px solid #e5d8f5;
  border-radius: 3px;
  padding: 0 0.3rem;
  font-family: inherit;
  font-size: inherit;
}
.dbws-chat-stats-sep {
  color: #9ca3af;
}
.dbws-chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: #fcfcfd;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Etappe 3 (0.5.40) — Aggregat-Fenster oben im Chat-Modal.
   Schmaler Streifen unter Header, NICHT scrollend (chat-history macht
   flex:1, das Aggregat hat eigene Höhe und sitzt fest). Listet pro
   Übernahme-Entscheidung eine Zeile mit Mapping + Toggle-Buttons + Status.
   Design: heller Card-Look mit deutlich fetterer Headline, mehr Abstand
   zwischen den Zeilen, Status-Pills mit klaren Farbcodes. */
.dbws-aggregate-wrapper {
  /* Etappe 3 (0.5.44): freistehende Card statt "Streifen unter Header".
     Margin zu allen Seiten, allseitige Border + Border-Radius, dezenter
     Schatten — sitzt visuell als eigenständige Komponente im Modal. */
  margin: 0.7rem 0.85rem 0.4rem;
  padding: 0 0.9rem 0.75rem;
  background: #fafbfd;
  border: 1px solid #d4dce6;
  border-radius: 0.6rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  max-height: 35vh;
  overflow-y: auto;
  flex-shrink: 0;
}
/* 0.5.54: Header der Card mit Toggle-Pfeil rechts. Click auf den
   ganzen Header-Bereich klappt die Liste auf/zu. */
.dbws-aggregate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin: 0 0 0.55rem;
  /* 0.5.336: Kopfzeile beim Scrollen der Mapping-Liste fixieren, damit der
     Einklapp-Toggle + Zaehler immer erreichbar bleiben (kein Hochscrollen).
     Scroll-Container ist .dbws-aggregate-wrapper (overflow-y:auto). */
  position: sticky;
  top: 0;
  background: #fafbfd;
  z-index: 2;
  padding-top: 0.65rem;
}
.dbws-aggregate-header:hover .dbws-aggregate-toggle {
  background: #e2e8f0;
}
.dbws-aggregate-headline {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 0.005em;
}
.dbws-aggregate-count {
  margin-left: 0.4rem;
  font-weight: 500;
  color: #64748b;
  font-size: 0.85rem;
}
.dbws-aggregate-toggle {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  /* 0.5.148: Aufklapp-Pfeil deutlich vergrößert (User-Wunsch 2026-06-01 —
     das ▾/▸-Glyph bei 0.95rem war zu klein zum Erkennen/Treffen). */
  font-size: 1.5rem;
  color: #475569;
  padding: 0.05rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
}
.dbws-aggregate-toggle:hover {
  background: #e2e8f0;
}
.dbws-aggregate-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dbws-aggregate-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  background: #fff;
  border: 1px solid #d4dce6;
  border-radius: 6px;
  font-size: 0.84rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.dbws-aggregate-row-as-rule {
  border-left: 3px solid #3b82f6;
  background: #f7faff;
}
.dbws-aggregate-mapping {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.dbws-aggregate-mapping code {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  font-size: 0.8rem;
}
.dbws-aggregate-arrow { color: #94a3b8; font-weight: 700; }
.dbws-aggregate-mapping strong {
  color: #1f2937;
  font-weight: 600;
}
/* Etappe 3 (0.5.41/0.5.42): User-Wunsch — "Als Regel"-Zeile macht die
   ganze Mapping-Überschrift blau, inklusive des Konstanten-Werts
   (= CPT etc.), damit der Regel-Status auf einen Blick erkennbar ist.
   Buttons-Toggle-State zeigt den User-Wunsch, Farbe der Headline
   bestätigt das Doppelt — die früher separate Status-Pill ist damit
   überflüssig (in 0.5.42 entfernt). */
.dbws-aggregate-row-as-rule .dbws-aggregate-mapping code,
.dbws-aggregate-row-as-rule .dbws-aggregate-mapping strong,
.dbws-aggregate-row-as-rule .dbws-aggregate-arrow {
  color: #1e40af;
}
.dbws-aggregate-row-as-rule .dbws-aggregate-mapping code {
  background: #e6efff;
  border-color: #93c5fd;
}
.dbws-aggregate-row-as-rule .dbws-aggregate-value {
  color: #1e40af;
  background: #e6efff;
  border-color: #93c5fd;
}
.dbws-aggregate-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #07502b;
  background: #ecf9f1;
  border: 1px dashed #9bd3b1;
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  font-weight: 600;
}
.dbws-aggregate-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
  text-align: center;
  /* Etappe 3 (0.5.41): Stabilisiert die Toggle-Position. Variable
     Pill-Texte ("EINMALIG" vs "WIRD REGEL BEIM FREIGEBEN") schoben
     vorher den Toggle sichtbar hin und her. Min-Width sorgt für
     vorhersehbare Pill-Größe; kürzere Texte werden zentriert. */
  min-width: 12rem;
}
.dbws-aggregate-status-temporary {
  background: #fff3c4;
  color: #92590f;
  border: 1px solid #f7d875;
}
.dbws-aggregate-status-rule_pending {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.dbws-aggregate-status-rule_active {
  background: #d2f3dd;
  color: #07502b;
  border: 1px solid #6bca90;
}

/* Etappe 3 (0.5.40) — Toggle-Buttons "Einmalig / Als Regel".
   Ersetzen die nativen <input type="radio"> die im Alpine-CSP-Build den
   gefüllten Punkt-Zustand nicht zuverlässig nachhielten. Zwei Buttons
   im Pill-Group-Layout, das aktive Button bekommt die -active-Variante.
   Gleiche Klasse für Bubble + Aggregat — visuell konsistent. */
.dbws-intent-toggle-group {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
/* 0.5.93: Lösch-Button rechts neben dem Einmalig/Als-Regel-Toggle im
   Aggregat-Eintrag. Grau, beim Hover rot — klassisches Delete-Affordance.
   Klick löscht Draft + deaktiviert ggf. Regel.
   0.5.95: von Mülleimer-Emoji auf × umgestellt — visuell klarer in der
   dichten Zeile. Etwas größere font-size + fettere line-height damit
   das × ähnlich präsent wie der Close-Button (×) im Modal-Header ist. */
.dbws-aggregate-remove {
  appearance: none;
  border: none;
  background: transparent;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}
.dbws-aggregate-remove:hover {
  color: #dc2626;
  background: #fef2f2;
}
.dbws-aggregate-remove:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 1px;
}

/* 0.5.96: Platzhalter im Viewer wenn ausgelagert. Zentriert in der
   Viewer-Spalte, Re-Embed-Button darunter. */
.dbws-viewer-popped-out {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 2rem 1rem;
  text-align: center;
  color: #6b7280;
  flex: 1;
}
.dbws-intent-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  border-right: 1px solid #cbd5e1;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.dbws-intent-toggle-btn:last-child { border-right: none; }
.dbws-intent-toggle-btn:hover:not(.dbws-intent-toggle-btn-active):not(.dbws-intent-toggle-btn-disabled) {
  background: #f1f5f9;
  color: #1f2937;
}
.dbws-intent-toggle-btn-active {
  background: #1e40af;
  color: #fff;
  font-weight: 700;
}
.dbws-intent-toggle-btn-disabled,
.dbws-intent-toggle-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.dbws-intent-toggle-btn-active.dbws-intent-toggle-btn-disabled {
  background: #94a3b8;  /* gedämpftes Blau wenn schon persistiert */
}

/* Inline-Toggle in der Vorschlags-Bubble — nur Margin-Tweak gegenüber
   den Aggregat-Buttons, sonst gleicher Look. */
.dbws-proposal-intent-toggle {
  margin-top: 0.55rem;
}
.dbws-chat-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #6b7280;
}
.dbws-chat-empty p { margin: 0.3rem 0; }
.dbws-chat-hint { font-size: 0.78rem; font-style: italic; }
.dbws-chat-msg {
  display: flex;
  align-items: flex-start;  /* Bubbles wachsen nicht in die Höhe wegen
                               geschwister-flex-items */
}
.dbws-chat-msg-user { justify-content: flex-end; }
.dbws-chat-msg-assistant { justify-content: flex-start; }
.dbws-chat-bubble {
  max-width: 80%;
  padding: 0.5rem 0.8rem;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px solid #d4e5d8;
  line-height: 1.35;
  word-break: break-word;
  /* Bewusst KEIN white-space: pre-wrap — Claude sendet sonst manchmal
     viele \n und die Bubble dehnt sich unnötig in die Höhe. Normale
     HTML-Whitespace-Behandlung reicht; absichtliche Absätze macht das
     Modell nicht. */
}
.dbws-chat-msg-user .dbws-chat-bubble {
  background: #e6f4ea;
  border-color: #2ec27e;
}
/* 0.5.110: Validation-Failure-Variante. Selbe Farbtonalität wie
   .dbws-chat-proposal[data-state="invalid_bc"|"invalid_constant"] damit
   Chat-Bubble und Proposal-Karten-Banner visuell konsistent sind. */
.dbws-chat-bubble-warning {
  background: #fef2f2;
  border-color: #f87171;
}
.dbws-chat-warning-title {
  margin: 0 0 0.35rem 0;
  color: #b91c1c;
  font-size: 0.9rem;
  line-height: 1.3;
}
.dbws-chat-warning-title strong {
  font-weight: 700;
}
/* 0.5.111: Proposal-Headline-Pille im Warning-Bubble. Re-Use von
   .dbws-proposal-arrow/.dbws-proposal-value/.dbws-proposal-conf damit
   Bubble und Karte konsistent aussehen. */
.dbws-chat-warning-proposal {
  margin: 0 0 0.35rem 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.dbws-chat-warning-proposal code {
  background: #ffffff;
  border: 1px solid #f87171;
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  font-size: 0.85rem;
  color: #1f2937;
}
.dbws-chat-warning-proposal strong {
  color: #1f2937;
  font-weight: 700;
}
.dbws-chat-content {
  margin: 0;
  font-size: 0.85rem;
  /* 0.5.56: pre-line erhält Newlines im content, damit Debug- und
     mehrzeilige Hinweise (z.B. Header-Extraction-No-Match mit Pattern +
     Header-Preview) lesbar dargestellt werden. */
  white-space: pre-line;
}
/* P3.3 Followup #8: nur Assistant-Bubbles bekommen die größere Schrift,
   User-Bubble bleibt schlank. */
.dbws-chat-msg-assistant .dbws-chat-content { font-size: 0.95rem; }
.dbws-chat-proposals {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dbws-chat-proposal {
  padding: 0.45rem 0.6rem;
  border: 1px solid #d4e5d8;
  border-radius: 4px;
  background: #f5fafb;
}
.dbws-chat-proposal[data-state="applied"] {
  background: #d2f3dd;
  border-color: #2ec27e;
}
.dbws-chat-proposal[data-state="dismissed"] {
  background: #f3f4f6;
  border-color: #d1d5db;
  opacity: 0.7;
}
.dbws-chat-proposal[data-state="invalid_bc"],
.dbws-chat-proposal[data-state="invalid_constant"] {
  background: #fef2f2;
  border-color: #f87171;
}
.dbws-proposal-headline {
  margin: 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.dbws-proposal-headline code {
  background: #fff;
  border: 1px solid #d4e5d8;
  border-radius: 3px;
  padding: 0 0.25rem;
}
.dbws-proposal-arrow { color: #6b7280; }
/* Etappe 2 (0.5.35): "= <Wert>" hinter dem Target bei Konstanten-Vorschlägen.
   Optisch dezenter als der Source-Code-Block, aber klar lesbar. */
.dbws-proposal-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #1f6f3f;
  background: #fff;
  border: 1px dashed #d4e5d8;
  border-radius: 3px;
  padding: 0 0.25rem;
}
.dbws-proposal-conf {
  color: #6b7280;
  font-size: 0.72rem;
  margin-left: auto;
}
.dbws-proposal-reason {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #4b5563;
}
.dbws-proposal-actions {
  margin-top: 0.9rem;     /* Leerzeile vor den Buttons */
  display: flex;
  gap: 0.4rem;
}
.dbws-proposal-actions .docbridge-btn-primary,
.dbws-proposal-actions .docbridge-btn-secondary {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
}
.dbws-proposal-state {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
}
.dbws-proposal-applied { color: #07502b; }
.dbws-proposal-dismissed { color: #6b7280; }
.dbws-proposal-invalid { color: #b91c1c; }

.dbws-chat-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.85rem;
  padding: 0.3rem 0;
}
.dbws-chat-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 3px solid #d4e5d8;
  border-top-color: #1e8f4d;
  border-radius: 50%;
  animation: docbridge-spin 0.9s linear infinite;
  display: inline-block;
}
.dbws-chat-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #d4e5d8;
  align-items: flex-end;
}
.dbws-chat-footer textarea {
  flex: 1;
  resize: vertical;
  min-height: 2.2rem;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d4e5d8;
  border-radius: 4px;
}
.dbws-chat-footer textarea:focus {
  outline: 2px solid #1e8f4d;
  outline-offset: -1px;
}

/* P3.3 — Save-Rule-Bereich oberhalb der Chat-Eingabe.
   Toggle-Button steht in dem Bereich; beim Klick erweitert er sich
   zur kompletten Save-Box mit Listing + Scope-Radios + Aktionen. */
.dbws-save-rule-bar {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #d4e5d8;
  background: #fcfcfd;
}
.dbws-save-rule-toggle {
  font-size: 0.78rem;
}
.dbws-save-rule-box {
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dbws-save-rule-headline {
  margin: 0;
  font-size: 0.85rem;
  color: #1f2937;
}
.dbws-save-rule-list {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d4e5d8;
  border-radius: 4px;
  background: #fff;
  max-height: 8rem;
  overflow-y: auto;
  font-size: 0.78rem;
}
.dbws-save-rule-list li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0;
}
.dbws-save-rule-list code {
  background: #fffaef;
  border: 1px solid #f3e3b3;
  border-radius: 3px;
  padding: 0 0.25rem;
  font-family: inherit;
}
.dbws-save-rule-scope {
  border: 1px solid #d4e5d8;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.dbws-save-rule-scope legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1f2937;
  padding: 0 0.2rem;
}
.dbws-save-rule-scope label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.dbws-save-rule-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.dbws-save-rule-actions .docbridge-btn-primary,
.dbws-save-rule-actions .docbridge-btn-secondary {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
}
.dbws-prompt-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dbws-prompt-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.dbws-prompt-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}
.dbws-prompt-scope-info {
  margin: 0;
  font-size: 0.85rem;
  color: #555;
}
.dbws-divider {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 0.5em 0;
}
.dbws-prompt-rule-title {
  margin: 0 0 0.4em;
  font-weight: 600;
}
.dbws-prompt-rule-scope {
  border: 0;
  padding: 0;
  margin: 0;
}
.dbws-prompt-rule-scope label {
  display: block;
  padding: 0.3em 0;
  cursor: pointer;
}
.dbws-prompt-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 0.6em;
  justify-content: flex-end;
  background: #fafafa;
}
.dbws-prompt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: #f7a30e;
  color: #fff;
  padding: 0.5em 1.1em;
  border-radius: 0.35em;
  font-weight: 700;
  font-size: 0.95rem;
  border: 0;
  cursor: pointer;
  margin-left: 0.5em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, transform 0.05s ease;
}
.dbws-prompt-trigger:hover {
  background: #d68a07;
}
.dbws-prompt-trigger:active {
  transform: translateY(1px);
}

/* === Inbox: Doc-Gruppierung (Refine Inbox-Doc-Grouping, 2026-05-24) ===
   Eine Karte pro Quelldokument (statt einer Tabellenzeile pro Sendung).
   Layout: flex-row mit Wrap, sodass Status-Mix-Sub-Row + Sammel-Meta
   eine neue Zeile unterhalb der Karte starten können. */
.docbridge-inbox-header { margin-bottom: 1.5rem; }
.docbridge-inbox-header h1 { margin: 0 0 0.25em; font-size: 1.6rem; }
.docbridge-inbox-summary { margin: 0; color: #555; font-size: 0.9rem; }

.dbi-section { margin-bottom: 2rem; }
.dbi-section-header {
  display: flex; align-items: center; gap: 0.5em;
  font-size: 1.05rem; font-weight: 700;
  padding: 0.6em 0; margin: 0 0 0.5em;
  border-bottom: 1px solid #d4e5d8;
}
.dbi-section-count { color: #777; font-weight: 500; font-size: 0.9rem; }
.dbi-doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.dbi-doc-row {
  display: flex; align-items: center; gap: 0.8em;
  padding: 0.7em 1em;
  background: #fff;
  border: 1px solid #e0e7e2;
  border-radius: 0.4em;
  flex-wrap: wrap;
}
.dbi-doc-row:hover { background: #f5fafb; border-color: #c0d4c5; }
/* Eingang-Karten heben sich farblich ab — das ist der Action-Bucket. */
.dbi-doc-row-eingang { background: #fffaf2; border-color: #f0d6a0; }
.dbi-doc-row-eingang:hover { background: #fff5e8; }
.dbi-doc-check { margin-right: 0.3em; }
.dbi-ampel { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dbi-ampel-gruen  { background: #2ec27e; }
.dbi-ampel-gelb   { background: #f7a30e; }
.dbi-ampel-orange { background: #ff8800; }
.dbi-ampel-rot    { background: #d63838; }
.dbi-doc-name { flex: 1; font-weight: 600; word-break: break-word; }
.dbi-doc-kanal { font-size: 0.85rem; color: #777; }
.dbi-doc-auto {
  font-size: 0.8rem; font-weight: 600;
  padding: 0.15em 0.6em;
  background: #e6f4ea; color: #1e5b34;
  border-radius: 0.25em;
}
.dbi-doc-meta { font-size: 0.85rem; color: #555; }
.dbi-doc-time { font-size: 0.8rem; color: #999; }
.dbi-btn { flex-shrink: 0; }
.dbi-doc-status-mix {
  flex-basis: 100%; padding-left: 2em;
  font-size: 0.8rem; color: #999;
}

/* Modal doc-grouped list — gleicher Bau wie .dbi-doc-* aber kompakter
   (das Modal hat weniger horizontalen Platz als die Inbox-Seite). */
.docbridge-modal-doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
/* Vorher: display: flex + flex-wrap auf <tr> hatte die Tabelle in
   ein Stack-Layout zerlegt (jede TD untereinander statt nebeneinander).
   Jetzt rendert .docbridge-modal-doc-row als reguläre Tabellenzeile. */
.docbridge-modal-doc-row:hover { background: #f5fafb; }
.docbridge-modal-doc-check { margin: 0; }
.docbridge-modal-doc-name { font-weight: 600; }
.docbridge-modal-doc-kanal, .docbridge-modal-doc-meta { font-size: 0.85rem; color: #777; }
.docbridge-modal-doc-auto {
  font-size: 0.8rem; font-weight: 600;
  padding: 0.15em 0.5em;
  background: #e6f4ea; color: #1e5b34;
  border-radius: 0.25em;
}
.docbridge-modal-doc-btn { flex-shrink: 0; padding: 0.3em 0.7em; font-size: 0.85rem; }

/* === Refine-Modal-Redesign (2026-05-24) ===
   Table-Layout für das Posteingang-Modal mit Master-Checkbox-Header und
   per-Row-Checkbox / Ampel / Filename / Kanal / Action-Spalten. Das
   überschreibt teilweise die Card-Styles oberhalb (TR statt LI). */
.docbridge-modal-master-check {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-weight: 600; cursor: pointer;
  color: #555;
}
.docbridge-modal-master-check input { margin: 0; }

/* Fixed-layout + explizite Spaltenbreiten, damit die Header und die
   Daten-Zellen exakt fluchten — vorher waren die Header rechtsbündig
   geschoben, weil die leeren <th> ohne `width:` 0 breit waren. */
.docbridge-modal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.docbridge-modal-table .dbm-col-check  { width: 36px; }
.docbridge-modal-table .dbm-col-ampel  { width: 24px; }
.docbridge-modal-table .dbm-col-name   { width: auto; }
.docbridge-modal-table .dbm-col-time   { width: 130px; }
.docbridge-modal-table .dbm-col-kanal  { width: 80px; }
.docbridge-modal-table .dbm-col-action { width: 130px; }
.docbridge-modal-table .dbm-col-delete { width: 44px; }
.docbridge-modal-doc-time { font-size: 0.85rem; color: #666; white-space: nowrap; }
.docbridge-modal-doc-subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: #666;
  margin-top: 0.15em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docbridge-modal-doc-delete-col { text-align: center; }
.docbridge-modal-doc-trash {
  background: none; border: 0; cursor: pointer;
  font-size: 1.05rem; padding: 0.2em 0.4em;
  border-radius: 0.25em;
  color: #999;
  transition: background 120ms ease-in-out, color 120ms ease-in-out;
}
.docbridge-modal-doc-trash:hover { background: #fff5f5; color: #d63838; }
.docbridge-modal-doc-trash:focus {
  outline: none; box-shadow: 0 0 0 3px rgba(214, 56, 56, 0.25);
}

/* === Upload-Modal (2026-05-24) === */
.docbridge-modal-upload {
  max-width: min(90vw, 580px);
}
.docbridge-upload-form { display: flex; flex-direction: column; gap: 1.25rem; }
.docbridge-upload-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  border: 2px dashed #cdd6cf;
  border-radius: 0.5rem;
  background: #f9fbfa;
  cursor: pointer;
  transition: border-color 150ms ease-in-out, background 150ms ease-in-out;
  text-align: center;
}
.docbridge-upload-dropzone:hover { border-color: #2e7d32; background: #f0faf3; }
.docbridge-upload-dropzone.docbridge-dnd-over {
  border-color: #2e7d32; background: #e6f4ea; border-style: solid;
}
.docbridge-upload-dropzone-icon, .docbridge-upload-dropzone-check { color: #2e7d32; }

/* WICHTIG: `:not([hidden])` damit `display: flex` NICHT das `hidden`-
   Attribut überschreibt (siehe `purple/standards/frontend/visibility-
   toggles.md`). Sonst sind beide States gleichzeitig sichtbar/verdeckt
   und das JS-Toggle wirkt nicht. */

/* Empty-State: Cloud-Icon zentriert + Text zentriert */
.docbridge-upload-dropzone-empty:not([hidden]) {
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.docbridge-upload-dropzone-text { display: flex; flex-direction: column; gap: 0.25em; text-align: center; }
.docbridge-upload-dropzone-text strong { font-size: 1rem; color: #1e5b34; }
.docbridge-upload-dropzone-formats { font-size: 0.8rem; color: #999; }

/* Filled-State: Checkmark links + Datei-Info Mitte + Clear-X rechts */
.docbridge-upload-dropzone-filled:not([hidden]) {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
}
.docbridge-upload-dropzone-check { flex-shrink: 0; }
.docbridge-upload-dropzone-fileinfo {
  flex: 1; display: flex; flex-direction: column; gap: 0.15em;
  text-align: left; overflow: hidden;
}
.docbridge-upload-filename {
  font-size: 1rem; color: #1e5b34;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.docbridge-upload-filesize {
  font-size: 0.85rem; color: #666;
}
.docbridge-upload-clear {
  background: none; border: 0; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: #999;
  padding: 0.2em 0.5em; border-radius: 0.25em;
  transition: background 120ms ease-in-out, color 120ms ease-in-out;
}
.docbridge-upload-clear:hover { background: #fff5f5; color: #d63838; }

/* Wenn die Dropzone "gefüllt" ist, etwas dezenter (kein Hover-Highlight). */
.docbridge-upload-dropzone:has([data-upload-filled-state]:not([hidden])) {
  border-style: solid; border-color: #2e7d32; background: #f0faf3;
}
.docbridge-upload-file {
  /* hide the native input — die ganze Dropzone-Label fängt clicks ab */
  position: absolute; opacity: 0; width: 1px; height: 1px;
  pointer-events: none;
}
.docbridge-upload-field { display: flex; flex-direction: column; gap: 0.35em; }
/* 0.5.399: [hidden] muss die eigene display:flex oben schlagen — siehe
   Standard frontend/visibility-toggles.md (Attribut-Selektor > Klasse-
   Selektor durch die zusätzliche Attribut-Spezifität). Betrifft z.B. das
   per JS ein-/ausgeblendete DTL/Spedition-Feld im Upload-Modal. */
.docbridge-upload-field[hidden] { display: none; }
.docbridge-upload-field label { font-size: 0.9rem; font-weight: 600; color: #333; }
.docbridge-upload-field input {
  padding: 0.5em 0.75em;
  border: 1px solid #d1d5db;
  border-radius: 0.3rem;
  font-size: 0.95rem;
}
.docbridge-upload-field input:focus {
  outline: none; border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.docbridge-upload-field-hint { font-size: 0.8rem; color: #777; margin: 0; }
.docbridge-upload-error {
  padding: 0.6em 0.8em;
  background: #fff5f5;
  border: 1px solid #fbb;
  border-radius: 0.3rem;
  color: #b32626;
  font-size: 0.9rem;
}

/* Hochladen-Card als Button-Element bekommt Card-Look ohne <a>-Default. */
button.docbridge-card-upload {
  font: inherit;
  text-align: left;
  width: 100%;
}
.docbridge-card-upload.docbridge-dnd-over {
  border-color: #2e7d32;
  background: #e6f4ea;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}
.docbridge-modal-table thead th {
  text-align: left; padding: 0.4em 0.5em;
  font-size: 0.8rem; color: #666; font-weight: 600;
  border-bottom: 1px solid #ddd; background: #f5fafb;
}
.docbridge-modal-table td {
  padding: 0.5em; vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}
.docbridge-modal-table tbody tr:hover { background: #f9fbfa; }
/* In the table-row variant the doc-name column ellipsis-truncates long
   filenames; full name is exposed via `title=` attribute on the TD. */
.docbridge-modal-table .docbridge-modal-doc-name {
  font-weight: 600;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docbridge-modal-footer button[data-action="bulk-process"]:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* =========================================================================
 * API-Status-Banner (DocBridge) — 0.5.187.
 * Look angelehnt an den p0-Outage-Banner: dezenter Amber-Streifen mit
 * Warn-Icon, Text und Schließen-×. Inline-Styles sind unter CSP
 * (style-src 'self') verboten → alles als Klasse hier.
 * ========================================================================= */
.docbridge-api-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 0.375rem;
  color: #9a3412;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.docbridge-api-banner-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  color: #ea580c;
}
.docbridge-api-banner-text { flex: 1 1 auto; }
/* 0.5.188: kein Schließen-Button mehr (Status-Banner). .is-dismissed bleibt
   als künftiger Hide-Hook, sobald das Banner an den echten API-Status
   gekoppelt wird (einblenden nur bei Outage). */
.docbridge-api-banner.is-dismissed { display: none; }
/* 0.5.190: Während das Verarbeitungs-Overlay (z-index:10) läuft, soll das
   ECHTE API-Banner sichtbar/scharf bleiben (statt dahinter abzudunkeln oder
   doppelt geklont zu werden). Das Banner liegt im Modal-Body (nicht
   positioniert → kein eigener Stacking-Context), daher hebt position:relative
   + z-index:11 es im .docbridge-modal-Kontext über das Overlay. */
.docbridge-modal-body > .docbridge-api-banner {
  position: relative;
  z-index: 11;
}

/* =========================================================================
 * Regel-Verwaltung — gruppierte Ansicht pro Versender (0.5.193/0.5.194).
 * Status-Filter-Chips + Versender-Karten mit Ampel + lesbare Mapping-Zeilen.
 * ========================================================================= */
/* 0.5.194: Sektion links/rechts einrücken (~1 cm) statt randbündig. */
.docbridge-admin-regeln {
  padding: 0.5rem 2.5rem 2.5rem 2.5rem;
}
.docbridge-regel-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem 0;
}
.docbridge-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f9fafb;
  color: #374151;
  font-size: 0.8125rem;
  text-decoration: none;
  cursor: pointer;
}
.docbridge-chip:hover { background: #f3f4f6; }
.docbridge-chip-active {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.docbridge-chip-gelb.docbridge-chip-active   { border-color: #ea580c; background: #fff7ed; color: #9a3412; }
.docbridge-chip-gruen.docbridge-chip-active  { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.docbridge-chip-grau.docbridge-chip-active   { border-color: #6b7280; background: #f3f4f6; color: #374151; }

.docbridge-regelgruppe {
  border: 1px solid #e5e7eb;
  border-left-width: 4px;
  border-radius: 0.5rem;
  margin: 0 0 1rem 0;
  background: #fff;
  overflow: hidden;
}
.docbridge-regelgruppe-gelb  { border-left-color: #ea580c; }
.docbridge-regelgruppe-gruen { border-left-color: #16a34a; }
.docbridge-regelgruppe-grau  { border-left-color: #9ca3af; }

.docbridge-regelgruppe-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: #f9fafb;
  border-bottom: 1px solid #eef2f7;
}
.docbridge-regelgruppe-ampel {
  flex: 0 0 auto;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #9ca3af;
}
.docbridge-regelgruppe-ampel-gelb  { background: #f59e0b; }
.docbridge-regelgruppe-ampel-gruen { background: #22c55e; }
.docbridge-regelgruppe-ampel-grau  { background: #9ca3af; }
.docbridge-regelgruppe-mc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: #111827;
}
.docbridge-regelgruppe-summary {
  color: #6b7280;
  font-size: 0.8125rem;
}
.docbridge-regelgruppe-approve { margin-left: auto; }

.docbridge-regel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docbridge-regel-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid #f3f4f6;
}
.docbridge-regel-item:first-child { border-top: 0; }
.docbridge-regel-statuschip {
  flex: 0 0 auto;
  margin-top: 0.1rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.docbridge-regel-statuschip-ausstehend  { background: #fff7ed; color: #9a3412; }
.docbridge-regel-statuschip-aktiv       { background: #f0fdf4; color: #15803d; }
.docbridge-regel-statuschip-deaktiviert { background: #f3f4f6; color: #6b7280; }
.docbridge-regel-body { flex: 1 1 auto; min-width: 0; }
.docbridge-regel-desc-line {
  font-size: 0.875rem;
  color: #1f2937;
  line-height: 1.4;
}
.docbridge-regel-meta {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: #9ca3af;
}
.docbridge-regel-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
/* 0.5.194: Versender-Name als Karten-Titel neben dem Matchcode. */
.docbridge-regelgruppe-name {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}
/* 0.5.194: Ein-/Ausklappen pro Gruppe. */
.docbridge-regelgruppe-toggle {
  flex: 0 0 auto;
  background: none;
  border: 0;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  color: #475569;
  line-height: 1;
}
.docbridge-regelgruppe-toggle:hover { color: #1d4ed8; }
.docbridge-regelgruppe-caret {
  display: inline-block;
  font-size: 1.35rem;
  transition: transform 0.12s ease;
}
.docbridge-regelgruppe.is-collapsed .docbridge-regelgruppe-caret {
  transform: rotate(-90deg);
}
.docbridge-regelgruppe.is-collapsed .docbridge-regel-list {
  display: none;
}
/* 0.5.195: Abschnitts-Trennung (Feldmapping / Versender-Erkennung). */
.docbridge-admin-regeln .docbridge-section-title {
  margin-top: 2rem;
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
  color: #111827;
}
.docbridge-erkennung-list {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0;
}
.docbridge-erkennung-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-left-width: 4px;
  border-left-color: #22c55e;
  border-radius: 0.5rem;
  background: #fff;
  margin-bottom: 0.5rem;
}
.docbridge-erkennung-item.docbridge-regel-item-ausstehend  { border-left-color: #f59e0b; }
.docbridge-erkennung-item.docbridge-regel-item-deaktiviert { border-left-color: #9ca3af; }
.docbridge-erkennung-bedingung {
  flex: 1 1 auto;
  font-size: 0.85rem;
  color: #374151;
}

/* 0.5.202: Versender-Fundament-Karte (Merkmale + Profile + Regeln). */
.docbridge-filter-label {
  align-self: center;
  font-size: 0.8125rem;
  color: #6b7280;
  margin-right: 0.15rem;
}
/* 0.5.219/0.5.222: BU-Filter als kompaktes Dropdown. display:inline-block +
   width:auto überschreiben die globale select-Regel (display:block;width:100%),
   damit das Dropdown schmal bleibt statt die ganze Zeile zu füllen. */
.docbridge-bu-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  position: relative;
  top: 2px;                          /* 0.5.224: Dropdown minimal tiefer setzen */
}
.docbridge-bu-select {
  display: inline-block;
  width: auto;
  appearance: auto;
  padding: 0.3rem 1.8rem 0.3rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  color: #374151;
  font-size: 0.8125rem;
  line-height: 1.2;
  cursor: pointer;
  min-width: 5.5rem;
}
.docbridge-bu-select:hover { border-color: #9ca3af; }
.docbridge-bu-select:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px #bfdbfe;
}

/* 0.5.222/0.5.223: Regeln-Seite — Kopf mit BU-Bezug + kompakte Filterleiste. */
.docbridge-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.6rem 0;
  color: #1e8f4d;                  /* DTL-Grün */
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.docbridge-back-link:hover { text-decoration: underline; }
.docbridge-regeln-header {
  margin: 0 0 1rem 0;
  text-align: center;                /* 0.5.224: Kopf-Texte zentriert */
}
.docbridge-regeln-titlerow {
  display: flex;
  align-items: center;
  justify-content: center;           /* 0.5.224: Titel + BU-Badge mittig */
  flex-wrap: wrap;
  gap: 0.6rem;
}
.docbridge-regeln-titlerow .docbridge-page-title {
  margin: 0;
  font-weight: 800;                /* „Regeln verwalten" fett (User-Wunsch) */
}
.docbridge-regeln-bu-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #1e8f4d;            /* DTL-Grün */
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.docbridge-regeln-subtitle {
  margin: 0.35rem 0 0 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.5;
}
/* BU-Dropdown links + Status-Chips in EINER Zeile. */
.docbridge-regeln-filterbar {
  display: flex;
  align-items: center;
  justify-content: center;           /* 0.5.224: Filterzeile mittig */
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  margin: 0.75rem 0 1.25rem 0;
}
.docbridge-regeln-filterbar .docbridge-regel-filter {
  margin: 0;
  align-items: center;
}
/* 0.5.223: Dropdown + Status-Chips auf EXAKT gleiche Box-Höhe bringen, damit
   ihre Mittellinien sauber fluchten (align-items:center reicht optisch nicht,
   wenn die Box-Höhen minimal differieren). */
.docbridge-regeln-filterbar .docbridge-bu-select,
.docbridge-regeln-filterbar .docbridge-chip {
  min-height: 2rem;
  box-sizing: border-box;
}
.docbridge-regeln-filterbar .docbridge-chip {
  display: inline-flex;
  align-items: center;
}
.docbridge-regeln-filterbar .docbridge-filter-label {
  margin: 0;
}

/* 0.5.225: Generische, zentrierte Seiten-Kopf-Klassen — spiegeln den
   Regeln-Kopf-Stil, geteilt vom Archiv (Titel fett + BU-Badge + Untertitel). */
.docbridge-page-header {
  margin: 0 0 1rem 0;
  text-align: center;
}
.docbridge-page-titlerow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.docbridge-page-titlerow .docbridge-page-title {
  margin: 0;
  font-weight: 800;
}
.docbridge-page-bu-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: #1e8f4d;             /* DTL-Grün */
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.docbridge-page-subtitle {
  margin: 0.35rem 0 0 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* 0.5.226: Leerraum am Seitenanfang (Abstand zum Portal-Ribbon).
   0.5.229: zusätzlich seitliches Padding — Header/Filter/Grid sollen nicht
   am Fensterrand kleben. */
.docbridge-archiv {
  padding: 1.25rem 1.5rem 1.5rem;
}
/* 0.5.225: Archiv-Filterleiste — inline + zentriert, kompakte Felder. Die
   globale select/input-Regel (display:block;width:100%) wird hier auf
   width:auto zurückgesetzt, sonst füllt jedes Feld eine ganze Zeile. */
.docbridge-archiv-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1.5rem 0;
}
.docbridge-archiv-filter label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: left;
}
.docbridge-archiv-filter input,
.docbridge-archiv-filter select {
  width: auto;
  min-width: 8.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
}
.docbridge-archiv-filter .docbridge-btn-primary,
.docbridge-archiv-filter .docbridge-btn-secondary,
.docbridge-archiv-filter .docbridge-link {
  align-self: flex-end;
  margin-bottom: 0.1rem;
}

/* 0.5.227: Archiv-Grid (Tabelle war zuvor ungestylt). */
.docbridge-archiv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.docbridge-archiv-table thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #d4e5d8;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}
.docbridge-archiv-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #eef2f1;
  vertical-align: top;
}
.docbridge-archiv-table tbody tr:hover { background: #f6faf7; }
.docbridge-archiv-doc {
  min-width: 18rem;
  font-weight: 600;
}
.docbridge-archiv-hint {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: #6b7280;
}
.docbridge-archiv-edi {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #374151;
  white-space: nowrap;   /* 0.5.234: nicht umbrechen → bei Bedarf horiz. scrollen */
}
/* 0.5.260: Subzeile unter dem EDI-Dateinamen — verwendete Export-Schnittstelle
   (Name + Version). Bewusst sans-serif + gedämpft (Name, kein Dateiname). */
.docbridge-archiv-edi-schnittstelle {
  margin-top: 0.15rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6d28d9;
  white-space: nowrap;
}
/* 0.5.230/0.5.232: Analyse-Spalte — Methode-Badge, darunter die Gesamtkosten
   (zweite Zeile, deutsches Format). */
.docbridge-archiv-analyse { white-space: nowrap; }
.docbridge-archiv-cost {
  display: block;
  margin-top: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #6b7280;
}
.docbridge-archiv-status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eef2f1;
  color: #374151;
}
.docbridge-archiv-status-uebermittelt { background: #e7f5ec; color: #15803d; }
.docbridge-archiv-status-archiviert   { background: #eef2ff; color: #3730a3; }
.docbridge-archiv-status-verworfen    { background: #fde8e8; color: #b91c1c; }
/* 0.5.228: geschlossener Rahmen ums Grid. 0.5.234: overflow-x:auto → bei
   breitem Inhalt (z.B. langer EDI-Dateiname) erscheint ein horizontaler
   Scrollbalken, statt dass Zellen zeichenweise umbrechen. Die Höhe bleibt
   inhaltsbestimmt, daher kein vertikaler Scrollbalken. */
.docbridge-archiv-grid {
  border: 1px solid #d4e5d8;
  border-radius: 0.5rem;
  overflow-x: auto;
  background: #fff;
}
.docbridge-archiv-grid .docbridge-archiv-table thead th {
  background: #f3f8f4;
}
.docbridge-archiv-grid .docbridge-archiv-table tbody tr:last-child td {
  border-bottom: none;
}
.docbridge-bu-badge {
  flex: 0 0 auto;
  padding: 0.1rem 0.45rem;
  border-radius: 0.25rem;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.7rem;
  font-weight: 600;
}
.docbridge-versender-body { padding: 0.5rem 0.9rem 0.75rem; }
.docbridge-versender-erkennung {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
}
.docbridge-versender-sublabel {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
}
.docbridge-merkmal-chip {
  padding: 0.25rem 0.75rem;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.docbridge-versender-leer { color: #9ca3af; font-size: 0.8rem; }
.docbridge-profil {
  border: 1px solid #f0f2f5;
  border-radius: 0.4rem;
  margin-top: 0.5rem;
  overflow: hidden;
}
.docbridge-profil-head {
  padding: 0.35rem 0.7rem;
  background: #f8fafc;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
}
/* 0.5.203: Deaktivieren-Form kompakt — Grund-Input + Button in EINER Zeile. */
.docbridge-regel-actions .docbridge-deactivate-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}
.docbridge-regel-actions .docbridge-deactivate-form .docbridge-inline-input {
  width: 11rem;
  margin: 0;
}

/* ===========================================================================
   0.5.243: BU-Postfächer-Seite — Redesign (Kopf + gerahmtes Grid + aufklapp-
   bare Anlage-Card). Gestylt im Stil der Archiv-Seite (gleiche Farb-/Border-
   Tokens), bewusst unter .docbridge-admin-postfaecher gescopt, damit die
   Schemata-Seite (teilt einige Klassen) unverändert bleibt.
   =========================================================================== */
.docbridge-admin-postfaecher {
  padding: 1.25rem 1.5rem 1.5rem;
}
.docbridge-admin-postfaecher .docbridge-back-link {
  margin-bottom: 0.5rem;
}

/* -------- Liste: gerahmtes Grid (overflow-x für schmale Viewports) -------- */
.docbridge-postf-grid {
  border: 1px solid #d4e5d8;
  border-radius: 0.5rem;
  overflow-x: auto;
  background: #fff;
  margin: 0 0 1.75rem 0;
}
.docbridge-postf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.docbridge-postf-table thead th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 2px solid #d4e5d8;
  background: #f3f8f4;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}
.docbridge-postf-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #eef2f1;
  vertical-align: middle;
  color: #374151;
}
.docbridge-postf-table tbody tr:hover { background: #f6faf7; }
.docbridge-postf-table tbody tr:last-child td { border-bottom: none; }
.docbridge-postf-bu { font-weight: 700; white-space: nowrap; }
.docbridge-postf-host {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}
.docbridge-postf-muted { color: #9ca3af; }

/* Schnittstellen-Chip in der Liste (dezent, passt zu den Merkmal-Chips). */
.docbridge-postf-schnittstelle {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Status-Pille (aktiv = grün, deaktiviert = grau). */
.docbridge-postf-status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.docbridge-postf-status-active   { background: #e7f5ec; color: #15803d; }
.docbridge-postf-status-inactive { background: #f1f3f4; color: #6b7280; }
/* 0.5.265: Vollautomatik — „Auto"-Badge in der Postfach-Liste + Label-Zeile. */
.docbridge-postf-auto-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: help;
}
/* 0.5.268: „Automation: AUS" — dezent rötlich (weiche Rot-Palette wie sonst). */
.docbridge-postf-auto-badge--off {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.docbridge-postf-auto-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.docbridge-postf-auto-label input { flex: 0 0 auto; }
/* 0.5.266: „Verarbeitung läuft"-Spinner auf der Eingang-Kachel (Upload-Flow). */
.docbridge-card-eingang { position: relative; }
.docbridge-card-spinner {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 1.3rem;
  height: 1.3rem;
  box-sizing: border-box;
  border: 2px solid #d1d5db;
  border-top-color: #15803d;
  border-radius: 50%;
  animation: docbridge-spin 0.8s linear infinite;
}
@keyframes docbridge-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .docbridge-card-spinner { animation: none; }
}
/* 0.5.261: Standard-Export-Schnittstelle je Dokumenttyp — kleiner Marker
   neben der „aktiv"-Pille (violett, wie der Export-Schnittstellen-Akzent). */
.docbridge-schnittstellen-default-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: help;
}
/* 0.5.264: kompakter Button (z. B. „Als Standard" in der Standard-Spalte). */
.docbridge-btn-tiny {
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.4;
}
/* 0.5.262: Standard-Block im Bearbeiten-Dialog (Status/Button), abgesetzt. */
.docbridge-schnittstellen-default-edit {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid #eef0f2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.docbridge-schnittstellen-default-edit .docbridge-postf-field-hint { margin: 0; }

.docbridge-postf-empty {
  padding: 1.5rem 0.85rem;
  text-align: center;
  color: #9ca3af;
}

/* -------- Anlage: Button + aufklappbare Form-Card -------- */
.docbridge-postf-create {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
}
.docbridge-postf-create-toggle span[aria-hidden="true"] {
  font-weight: 700;
  margin-right: 0.15rem;
}
.docbridge-postf-form-card {
  width: 100%;
  border: 1px solid #d4e5d8;
  border-radius: 0.5rem;
  background: #fbfdfb;
  padding: 1.1rem 1.25rem 1.25rem;
}
.docbridge-postf-form-title {
  margin: 0 0 0.9rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}
/* Form-Raster: 1 Spalte mobil, 2 Spalten ab sm. Die Aktions-Zeile spannt
   über die volle Breite. */
.docbridge-postf-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem 1.25rem;
}
@media (min-width: 640px) {
  .docbridge-postf-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.docbridge-postf-form > label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}
.docbridge-postf-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
}
.docbridge-postf-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

/* -------- Pro-Zeile: Aktionen + aufklappbare Bearbeiten-Card -------- */
.docbridge-postf-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.docbridge-postf-actions .docbridge-inline-form { margin: 0; }
/* Die aufklappbare Edit-Zeile spannt über alle Spalten; dezenter Hintergrund
   grenzt sie visuell von den Datenzeilen ab. */
.docbridge-postf-edit-row > td {
  padding: 0.85rem;
  background: #f6faf7;
  border-bottom: 1px solid #eef2f1;
}
.docbridge-postf-edit-card {
  background: #ffffff;
  margin: 0;
}
.docbridge-postf-field-hint {
  font-size: 0.72rem;
  color: #9ca3af;
  line-height: 1.35;
}
/* Feld über die volle Formularbreite (z.B. Beschreibung im 2-Spalten-Raster). */
.docbridge-postf-field-wide { grid-column: 1 / -1; }

/* 0.5.246: Status-/Flash-Meldung rechtsbündig direkt über dem Grid. Die
   einzelnen Flash-Boxen schmiegen sich an Inhaltsbreite + rechten Rand. */
.docbridge-postf-flash {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  margin: 0 0 0.6rem 0;
}
.docbridge-postf-flash .docbridge-flash {
  margin: 0;
  text-align: right;
}

/* ===========================================================================
   0.5.247: Schnittstellen-Seite (read-only) — gleicher Look wie das Postfach-
   Grid (Archiv-Tokens), gescopt unter .docbridge-admin-schnittstellen.
   =========================================================================== */
.docbridge-admin-schnittstellen,
.docbridge-admin-schemas {
  padding: 1.25rem 1.5rem 1.5rem;
}
.docbridge-admin-schnittstellen .docbridge-back-link,
.docbridge-admin-schemas .docbridge-back-link {
  margin-bottom: 0.5rem;
}
/* Erstellt-Spalte (Masken-Schemata): dezent, nicht umbrechen. */
.docbridge-schemas-meta {
  color: #6b7280;
  font-size: 0.8rem;
  white-space: nowrap;
}
.docbridge-schnittstellen-grid {
  border: 1px solid #d4e5d8;
  border-radius: 0.5rem;
  overflow-x: auto;
  background: #fff;
}
.docbridge-schnittstellen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.docbridge-schnittstellen-table thead th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 2px solid #d4e5d8;
  background: #f3f8f4;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}
.docbridge-schnittstellen-table tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #eef2f1;
  vertical-align: middle;
  color: #374151;
}
.docbridge-schnittstellen-table tbody tr:hover { background: #f6faf7; }
.docbridge-schnittstellen-table tbody tr:last-child td { border-bottom: none; }
.docbridge-schnittstellen-name { font-weight: 700; white-space: nowrap; }
.docbridge-schnittstellen-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #3730a3;
}
.docbridge-schnittstellen-format {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.docbridge-schnittstellen-muted { color: #9ca3af; }
.docbridge-schnittstellen-filetype {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 0.25rem;
  background: #fde8e8;
  color: #b91c1c;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.docbridge-schnittstellen-empty {
  padding: 1.5rem 0.85rem;
  text-align: center;
  color: #9ca3af;
}
/* Abstand der „+ Neue Schnittstelle"-Sektion zum Grid. */
.docbridge-schnittstellen-create { margin-top: 1.5rem; }

/* =========================================================================
 * 0.5.275 — Rechnungs-Ansicht (templates/docbridge/rechnung.html).
 * Eigenes, scoped .dbr-* Layout (bewusst unabhaengig von den .dbws-*-
 * Workspace-Klassen): Beleg-Vorschau links, Kopf-Maske + Positionen rechts.
 * ========================================================================= */
.dbr-shell { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.5rem 0; }
.dbr-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.dbr-header-titles { display: flex; flex-direction: column; }
.dbr-header-title { font-weight: 700; font-size: 1.05rem; }
.dbr-header-file { font-size: 0.8rem; color: #6b7280; word-break: break-all; }
.dbr-badge { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; }
.dbr-badge-rg { background: #dbeafe; color: #1e40af; }
.dbr-badge-gs { background: #fef3c7; color: #92400e; }
.dbr-badge-unbestimmt { background: #e5e7eb; color: #4b5563; }
.dbr-back { margin-left: auto; font-size: 0.85rem; color: #2563eb; text-decoration: none; }
.dbr-back:hover { text-decoration: underline; }
.dbr-hint { font-size: 0.8rem; color: #6b5e2a; background: #fffaef; border: 1px solid #f3e3b3; border-radius: 0.5rem; padding: 0.5rem 0.75rem; margin: 0; }
.dbr-layout { display: flex; gap: 1rem; align-items: stretch; min-height: 60vh; }
.dbr-viewer { flex: 1 1 45%; display: flex; flex-direction: column; border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden; min-width: 320px; }
.dbr-viewer-frame { flex: 1; width: 100%; border: 0; background: #f9fafb; }
.dbr-col-header { background: #fffaef; border-bottom: 1px solid #f3e3b3; padding: 0.4rem 0.75rem; font-weight: 700; font-size: 0.85rem; }
.dbr-panel { flex: 1 1 55%; display: flex; flex-direction: column; gap: 1rem; min-width: 360px; }
.dbr-mask-block, .dbr-positions-block { border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden; }
.dbr-mask { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.5rem 1rem; padding: 0.75rem; }
.dbr-field { display: flex; flex-direction: column; gap: 0.15rem; }
.dbr-field-label { font-size: 0.72rem; font-weight: 600; color: #374151; }
.dbr-req { color: #dc2626; margin-left: 0.15rem; }
.dbr-field-input { font-size: 0.85rem; padding: 0.3rem 0.45rem; border: 1px solid #d1d5db; border-radius: 0.35rem; background: #fff; color: #111827; width: 100%; box-sizing: border-box; }
.dbr-field-input[readonly], .dbr-field-input[disabled] { background: #f9fafb; color: #4b5563; }
.dbr-field-src { font-size: 0.65rem; color: #9ca3af; }
.dbr-positions-wrap { overflow-x: auto; }
.dbr-positions { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.dbr-positions th, .dbr-positions td { border-bottom: 1px solid #eef0f2; padding: 0.35rem 0.6rem; text-align: left; white-space: nowrap; }
.dbr-positions th { background: #f9fafb; font-weight: 600; color: #374151; }
.dbr-positions-empty td { color: #9ca3af; font-style: italic; text-align: center; padding: 1rem; }
.dbr-netto { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 0.5rem 0.75rem; border-top: 1px solid #eef0f2; font-size: 0.85rem; }
.dbr-netto-label { color: #6b7280; }
.dbr-netto-value { font-weight: 700; }
@media (max-width: 900px) { .dbr-layout { flex-direction: column; } }

/* 0.5.277 — Rechnungs-Ansicht im 3-Spalten-Workspace-Layout. */
.dbr-workspace .dbws-col-uebersicht { display: flex; flex-direction: column; }
.dbr-c3-body { flex: 1; overflow: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 1rem; }
.dbr-sub-header { font-weight: 700; font-size: 0.8rem; color: #374151; background: #f9fafb; border-bottom: 1px solid #eef0f2; padding: 0.4rem 0.6rem; }

/* 0.5.282 — Belegtyp-Lock im Posteingang-Modal: gesperrte (anderer Typ) Zeilen ausgrauen. */
.docbridge-modal-doc-row.is-typelocked { opacity: 0.4; }

/* 0.5.285 - Rechnungs-Assistent: Oeffnen-Button mit Pending-Badge + Regel-Feedback. */
.dbr-assistent-open { position: relative; }
.dbr-assistent-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.1rem; height: 1.1rem; padding: 0 0.25rem; margin-left: 0.35rem; border-radius: 999px; background: #2563eb; color: #fff; font-size: 0.68rem; font-weight: 700; }
.dbr-rule-feedback { font-size: 0.75rem; color: #166534; margin-left: 0.5rem; }

/* 0.5.287 - RG-Kopf-Header: Aktionsgruppe rechts in der Titelleiste (Subtyp-Badge + KI-Assistent + Einklappen). */
.dbr-titlebar-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

/* 0.5.292 - Kopf-Maske im 521-Layout: 12-Spalten-Raster, Feldbreite je RechnungFeld.span. */
.dbr-mask { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
.dbr-col-2 { grid-column: span 2; }
.dbr-col-3 { grid-column: span 3; }
.dbr-col-4 { grid-column: span 4; }
.dbr-col-5 { grid-column: span 5; }
.dbr-col-6 { grid-column: span 6; }
.dbr-col-7 { grid-column: span 7; }
.dbr-col-8 { grid-column: span 8; }
.dbr-col-9 { grid-column: span 9; }
.dbr-col-10 { grid-column: span 10; }
.dbr-col-11 { grid-column: span 11; }
.dbr-col-12 { grid-column: span 12; }
@media (max-width: 760px) { .dbr-mask .dbr-field { grid-column: span 12; } }

/* 0.5.299: Rechnungs-Ansicht — Spalte 3 (Buchungsbeleg) ist die FLEXIBLE Spalte (fuellt den Rest, ueber den Viewer-Griff breiter ziehbar). Im Workspace gibt es dafuer Spalte 4; hier nicht. */
.dbr-workspace .dbws-col-uebersicht { flex: 1 1 auto; min-width: 360px; }
/* 0.5.299: kompakteres Kopf-Masken-Design (dichter, naeher am Auftrag). */
.dbr-mask { gap: 0.35rem 0.6rem; padding: 0.6rem 0.7rem; }
.dbr-field { gap: 0.1rem; }
.dbr-field-label { font-size: 0.68rem; }
.dbr-field-input { font-size: 0.8rem; padding: 0.25rem 0.4rem; }
.dbr-field-src { font-size: 0.6rem; }
.dbr-sub-header { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

/* 0.5.300: Spalte 4 (leer) wieder da → Spalte 3 ist wieder eine resizbare Spalte mit eigenem Griff, Spalte 4 fuellt den Rest (wie der Workspace). Ueberschreibt die 0.5.299-Regel. */
.dbr-workspace .dbws-col-uebersicht { flex: 0 0 480px; min-width: 320px; }
.dbr-workspace .dbws-col-detail { flex: 1 1 auto; min-width: 200px; }
.dbr-col4-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1rem; color: #9ca3af; font-size: 0.85rem; }

/* 0.5.301: Kopf-Maske spuerbar kompakter — Label + Herkunft in einer Zeile, flachere Eingabefelder, engere Abstaende. */
.dbr-field-labelrow { display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem; }
.dbr-field-labelrow .dbr-field-src { margin: 0; white-space: nowrap; flex-shrink: 0; }
.dbr-mask { gap: 0.3rem 0.6rem; padding: 0.55rem 0.7rem; }
.dbr-field { gap: 0.05rem; }
.dbr-field-input { padding: 0.18rem 0.4rem; font-size: 0.78rem; line-height: 1.25; }
select.dbr-field-input { height: auto; }
.dbr-mask-block { border-radius: 6px; }

/* 0.5.302: Herkunfts-Label entfernt; Felder moderat flach (komfortabel klickbar). Ueberschreibt die aggressiven 0.5.301-Werte. */
.dbr-field-input { padding: 0.32rem 0.45rem; font-size: 0.82rem; line-height: 1.3; }
.dbr-field { gap: 0.18rem; }
.dbr-mask { gap: 0.5rem 0.7rem; padding: 0.7rem 0.75rem; }
.dbr-field-label { font-size: 0.7rem; }

/* 0.5.303: Text- UND Dropdown-Felder exakt gleich hoch (gemeinsame feste Hoehe + box-sizing). */
.dbr-field-input { height: 1.95rem; box-sizing: border-box; }
select.dbr-field-input { height: 1.95rem; padding-top: 0.1rem; padding-bottom: 0.1rem; }

/* 0.5.304: Betrags-Felder (Netto/MwSt) rechtsbuendig. */
.dbr-field-input.dbr-num { text-align: right; font-variant-numeric: tabular-nums; }

/* 0.5.305: Betrags-Felder gruen, wenn die Konsistenzpruefung stimmt (Netto=Saldierung / MwSt-Satz / Brutto=Netto+MwSt). */
.dbr-field-input.dbr-ok { background: #e7f8ee; border-color: #86efac; color: #07502b; }

/* 0.5.307: Pflichtfeld-Ampel der Rechnung darf umbrechen (viele Segmente). */
.dbr-pflicht-header { flex-wrap: wrap; align-items: center; row-gap: 0.35rem; }
.dbr-pflicht-header .dbws-pflicht-ampel { display: flex; flex-wrap: wrap; gap: 0.3rem; flex: 1 1 auto; }

/* 0.5.313: Auto-Analyse-Turn ohne Sprechblasen-Optik — nur die Vorschlags-Karten (kein Chat-Verlauf bei frisch verarbeitetem Beleg). */
.dbr-chat-msg-auto { justify-content: stretch; }
.dbr-chat-msg-auto .dbws-chat-bubble { background: transparent; border: 0; box-shadow: none; padding: 0; max-width: 100%; width: 100%; }

/* 0.5.321 - Pruef-Checkliste (benannte Schritte + Status) im RG-Kopf-Bereich. */
.dbr-pruef-block { border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden; }
.dbr-pruef-list { list-style: none; margin: 0; padding: 0; }
.dbr-pruef-item { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0.6rem; border-bottom: 1px solid #eef0f2; }
.dbr-pruef-item:last-child { border-bottom: 0; }
.dbr-pruef-dot { flex: 0 0 auto; width: 0.7rem; height: 0.7rem; margin-top: 0.2rem; border-radius: 999px; background: #cbd5e1; }
.dbr-pruef-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1 1 auto; }
.dbr-pruef-labelrow { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.dbr-pruef-label { font-size: 0.8rem; font-weight: 600; color: #374151; }
.dbr-pruef-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: #6b7280; flex-shrink: 0; }
.dbr-pruef-detail { font-size: 0.72rem; color: #6b7280; line-height: 1.35; }
/* Status-Farben: offen=grau, laeuft=gelb, ok=gruen, Abweichung=rot. */
.dbr-pruef-item[data-status="laeuft"] .dbr-pruef-dot { background: #f59e0b; }
.dbr-pruef-item[data-status="ok"] .dbr-pruef-dot { background: #22c55e; }
.dbr-pruef-item[data-status="abweichung"] .dbr-pruef-dot { background: #ef4444; }
.dbr-pruef-item[data-status="laeuft"] .dbr-pruef-status { color: #b45309; }
.dbr-pruef-item[data-status="ok"] .dbr-pruef-status { color: #15803d; }
.dbr-pruef-item[data-status="abweichung"] .dbr-pruef-status { color: #b91c1c; }
.dbr-pruef-item[data-status="abweichung"] { background: #fef2f2; }

/* 0.5.321 - Spalte 4: Positionen-Grid (Anlage) rechts neben dem RG-Kopf. */
.dbr-workspace .dbws-col-detail { display: flex; flex-direction: column; }
.dbr-c4-body { flex: 1; overflow: auto; padding: 0.75rem; }

/* 0.5.323 - Positionen-Grid zeigt die Roh-Tabelle; Fusszeile mit Positionszahl. */
.dbr-positions-foot { display: flex; justify-content: flex-end; padding: 0.4rem 0.75rem; border-top: 1px solid #eef0f2; }
.dbr-positions-count { font-size: 0.75rem; color: #6b7280; }

/* 0.5.324 - Positionen-Grid: erkannte Betrags-Spalten rechtsbuendig + tabellarische Ziffern. */
.dbr-positions th.dbr-pos-num, .dbr-positions td.dbr-pos-num { text-align: right; font-variant-numeric: tabular-nums; }

/* 0.5.324 - Pruef-Checkliste als Vergleichs-Matrix (Tabelle, ausgewiesen vs. lt. Position). */
.dbr-pruef-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.dbr-pruef-table th, .dbr-pruef-table td { border-bottom: 1px solid #eef0f2; padding: 0.3rem 0.5rem; text-align: left; vertical-align: middle; }
.dbr-pruef-table thead th { background: #f9fafb; font-weight: 600; color: #6b7280; font-size: 0.7rem; }
.dbr-pruef-rowlabel { font-weight: 600; color: #374151; }
.dbr-pruef-table td.dbr-pruef-num, .dbr-pruef-table th.dbr-pruef-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dbr-pruef-statuscell { white-space: nowrap; }
.dbr-pruef-zeitraum { margin-top: 0.6rem; }
.dbr-pruef-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 999px; background: #cbd5e1; margin-right: 0.35rem; vertical-align: middle; }
.dbr-pruef-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: #6b7280; vertical-align: middle; }
.dbr-pruef-table tr[data-status="laeuft"] .dbr-pruef-dot { background: #f59e0b; }
.dbr-pruef-table tr[data-status="ok"] .dbr-pruef-dot { background: #22c55e; }
.dbr-pruef-table tr[data-status="abweichung"] .dbr-pruef-dot { background: #ef4444; }
.dbr-pruef-table tr[data-status="laeuft"] .dbr-pruef-status { color: #b45309; }
.dbr-pruef-table tr[data-status="ok"] .dbr-pruef-status { color: #15803d; }
.dbr-pruef-table tr[data-status="abweichung"] .dbr-pruef-status { color: #b91c1c; }
.dbr-pruef-table tr[data-status="abweichung"] td, .dbr-pruef-table tr[data-status="abweichung"] th { background: #fef2f2; }

/* 0.5.340 - Per-Position-Konsistenz: Zeile im Pruef-Block + abweichende Grid-Zeilen rot. */
.dbr-pruef-pos { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; padding: 0.45rem 0.5rem; border-top: 1px solid #eef0f2; font-size: 0.78rem; flex-wrap: wrap; }
.dbr-pruef-pos-label { font-weight: 600; color: #374151; }
.dbr-pruef-pos .dbr-pruef-detail { color: #6b7280; }
.dbr-pruef-pos[data-status="ok"] .dbr-pruef-dot { background: #22c55e; }
.dbr-pruef-pos[data-status="abweichung"] .dbr-pruef-dot { background: #ef4444; }
.dbr-pruef-pos[data-status="ok"] .dbr-pruef-status { color: #15803d; }
.dbr-pruef-pos[data-status="abweichung"] .dbr-pruef-status { color: #b91c1c; }
.dbr-positions tr.dbr-pos-row-dev td { background: #fef2f2; }

/* 0.5.341 - Rechnungs-Ansicht Layout-Fixes. */
/* (1) Spalte 3 (Buchungsbeleg) scrollt vertikal bei zu hohem Inhalt - Flexbox
   braucht min-height:0, sonst ueberlaeuft der Inhalt die Spalte (overflow:hidden)
   statt zu scrollen. */
.dbr-c3-body { min-height: 0; }
/* (2) Eingeklappte Spalten wirklich schmal (36px): die per-Spalte min-width-
   Overrides (0.5.300/0.5.301: 320px/200px) wuerden die 36px-Rail sonst aufblaehen. */
.dbr-workspace .dbws-col.is-collapsed { min-width: 0 !important; max-width: 36px; }

/* 0.5.342 - Spalte 3 zuverlaessig vertikal scrollbar (explizit + hoehere
   Spezifitaet, falls min-height:0 allein nicht greift): Hint-Header fix, Body
   fuellt den Rest und scrollt. */
.dbr-workspace .dbws-col-uebersicht > .dbws-raw-struct-hint-header { flex: 0 0 auto; }
.dbr-workspace .dbr-c3-body { flex: 1 1 0; min-height: 0; overflow-y: auto; }

/* 0.5.344 - Positionen-Spalte (Spalte 4) nicht mehr ueber die volle Monitor-
   breite ziehen: feste Standard-Breite (~480px), weiterhin per Griff resizbar;
   der Viewer (Spalte 2, flex-grow) fuellt den Rest, keine Leerflaeche. */
.dbr-workspace .dbws-col-detail { flex: 0 1 480px; }

/* 0.5.348 - Titelleiste Spalte 3: Titel + RG/GS-Badge als linke Gruppe
   (Badge direkt neben dem Titel), Aktionen rechts. */
.dbr-titlebar-left { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1 1 auto; }
.dbr-titlebar-left .dbws-col-header-title { flex: 0 1 auto; }

/* 0.5.349 - Positionen-Grid: einziger Scroll-Container ist der Tabellen-Wrap
   (x+y), damit der Tabellenkopf fixiert (sticky) bleibt. col4-Header oben fix,
   Fusszeile unten fix. */
.dbr-workspace .dbws-col-detail { overflow: hidden; }
.dbr-workspace .dbws-col-detail > .dbws-col-header { flex: 0 0 auto; }
.dbr-c4-body { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.dbr-c4-body .dbr-positions-block { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dbr-c4-body .dbr-positions-wrap { flex: 1 1 0; min-height: 0; overflow: auto; }
.dbr-c4-body .dbr-positions-foot { flex: 0 0 auto; }
.dbr-positions thead th { position: sticky; top: 0; z-index: 2; }

/* 0.5.355: Pflichtfeld-Tooltip (Rechnungs-Ansicht) — inhaltsgrosser Tooltip,
   per JS am gehoverten Chip positioniert (position:fixed -> escapt das
   Scroll-Clipping der Spalte 3), mit Caret + Auto-Flip nach oben + horizon-
   talem Clamping ans Fenster. Sichtbarkeit ueber die JS-Klasse .dbr-tip-on
   statt :hover (kein Fehl-Flash vor dem Positionieren). Nur .dbr-pflicht-
   header — der Auftrags-Tooltip bleibt unveraendert. */
.dbr-pflicht-header .dbws-pflicht-seg:hover .dbws-pflicht-tooltip,
.dbr-pflicht-header .dbws-pflicht-seg:focus-within .dbws-pflicht-tooltip,
.dbr-pflicht-header .dbws-pflicht-seg:focus .dbws-pflicht-tooltip { display: none; }
.dbr-pflicht-header .dbws-pflicht-tooltip { right: auto; min-width: 0; max-width: 22rem; margin: 0; }
.dbr-pflicht-header .dbws-pflicht-seg .dbws-pflicht-tooltip.dbr-tip-on { display: block; }
.dbr-pflicht-header .dbws-pflicht-tooltip::after {
  content: ""; position: absolute; left: var(--caret-x, 16px);
  transform: translateX(-50%); width: 0; height: 0; border: 6px solid transparent;
}
.dbr-pflicht-header .dbws-pflicht-tooltip[data-pos="below"]::after { top: -12px; border-bottom-color: #1f2937; }
.dbr-pflicht-header .dbws-pflicht-tooltip[data-pos="above"]::after { bottom: -12px; border-top-color: #1f2937; }
