/* ============================================================================
   dAI Pro — global stylesheet

   Designsprache seit 07/2026 identisch zum TYPO3-Modul d-ai-pro: nüchterne
   Flächen, dünne 1px-Ränder, kleine Radien, keine farbigen Schatten. Farbe
   trägt nur noch die Marke (oranges „Connect" in Kopfzeile, Login und
   Über-Dialog) sowie die Status-Signale.

   Primäraktionen laufen über --color-button (schwarz auf weißer Schrift). Wer
   sie stattdessen im CI-Orange möchte, setzt dort schlicht var(--color-primary).
   --color-accent (blau) trägt nur noch Links, Fokusränder und Ladeanzeigen.

   Die Backend-Templates nutzen weiterhin die gewachsene Klassen-Sprache
   (.ai-connect-page, .action-card, .type-pill …) — deren Aussehen wird hier neu
   definiert, damit die Templates unverändert bleiben können.
   ========================================================================== */

@import url('https://rsms.me/inter/inter.css');

:root {
    /* Marke — bleibt orange */
    --color-primary:        #ff5c1c;
    --color-primary-hover:  #e04d12;
    --color-primary-contrast: #ffffff;
    --ci-main:              #ff5c1c;

    /* Primäraktionen (Buttons) — schwarz mit weißer Schrift */
    --color-button:         #1a1a1a;
    --color-button-hover:   #000000;
    --color-button-text:    #ffffff;

    /* Akzent für Links, Fokusränder, Ladeanzeigen */
    --color-accent:         #000000;
    --color-accent-hover:   #787b7f;

    /* Text */
    --font-color:           #1a1a1a;
    --color-text:           #333333;
    --color-heading:        #1a1a1a;
    --color-text-invert:    #ffffff;
    --color-muted:          #6a6a6a;

    /* Flächen */
    --color-bg:             #f7f7f7;
    --color-surface:        #ffffff;
    --color-surface-transparent: rgba(255, 255, 255, 0.86);
    --color-surface-alt:    #cfd4d9;   /* Aktions- und Listenzonen */
    --color-surface-contrast: #e9eaeb;
    --color-surface-head:   #787b7f;   /* geöffnete Dokumentzeile */
    --color-surface-head-hover: #8f9398; 
    --color-surface-body:   #aeb3b7;   /* Detailbereich einer Zeile */
    --color-surface-div:    #d0d6da;   /* Trennlinien im Detailbereich */
    --color-surface-inner:  #f2f2f2;
    --color-surface-dark:   #1a1a1a;

    /* Ränder */
    --color-border:         #dddddd;
    --color-border-muted:   #e5e5e5;

    /* Typografie */
    --font-sans: "InterVariable", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Radien — bewusst klein */
    --radius-sm:   2px;
    --radius-md:   4px;
    --radius-lg:   6px;
    --radius-pill: 999px;

    /* Schatten — nur noch für schwebende Ebenen */
    --shadow-card:  none;
    --shadow-modal: 0 20px 60px rgba(18, 18, 18, 0.35);

    /* Statusfarben */
    --st-pending-bg: #fff3cd; --st-pending-fg: #856404;
    --st-running-bg: #cce5ff; --st-running-fg: #004085;
    --st-done-bg:    #d4edda; --st-done-fg:    #155724;
    --st-failed-bg:  #f8d7da; --st-failed-fg:  #721c24;
    --st-cancel-bg:  #e2e3e5; --st-cancel-fg:  #495057;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-optical-sizing: auto;
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--color-heading); font-weight: 600; }
code { font-family: var(--font-mono); }

/* ============================================================================
   App-Rahmen: Kopfzeile, Meldungen, Login, Über-Dialog — Marke bleibt orange
   ========================================================================== */
.app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    /* Anker für das aufklappende Menü unterhalb des Breakpoints */
    position: relative;
}
.app-header__inner {
    max-width: 2000px;
    margin: 0 auto;
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.app-header__brand {
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--color-heading);
    letter-spacing: -0.01em;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
    flex: 0 0 auto;
}
.app-header__brand b { color: var(--color-primary); }
/* Navigation und Benutzerzeile stecken in einem Container: auf dem Desktop
   ist er die Kopfzeile selbst, mobil wird daraus das Klapp-Panel. */
.app-header__menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1 1 auto;
    min-width: 0;
}
.app-header__nav { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.app-header__nav a { color: var(--color-text); font-weight: 500; }
.app-header__nav a:hover { color: var(--color-primary); text-decoration: none; }
.app-header__spacer { margin-left: auto; }
.app-header__account { display: flex; align-items: center; gap: 1.25rem; flex: 0 0 auto; }
.app-header__user { color: var(--color-muted); font-size: 0.9em; }

/* -------------------------------------------------- Umschalter Betreiber|Kunde
   Zwei Knöpfe in einer Fassung, der gewählte hebt sich ab. In der Kundensicht
   färbt sich die Fassung im CI-Orange: Der Betreiber soll auf jeder Seite
   sehen, dass er gerade eingeschränkt hinschaut. */
.view-switch {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px;
    border: 1px solid var(--color-border-muted);
    border-radius: 999px;
    background: var(--color-surface-inner);
}
.view-switch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.view-switch__opt {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    font-size: 0.82em;
    line-height: 1;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.view-switch__opt:hover { color: var(--color-text); }
.view-switch__opt.is-active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    cursor: default;
}
.view-switch.is-customer { border-color: var(--color-primary); background: rgba(255, 92, 28, 0.12); }
.view-switch.is-customer .view-switch__opt.is-active { background: var(--color-primary); color: var(--color-primary-contrast); }
.view-switch__opt:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------------------------------------------------------------- Hamburger
   Formensprache wie auf www.dreistein.de: weich gerundete Fläche mit
   2px-Kontur, im Hover/Offen-Zustand füllt sie sich mit dem CI-Orange.
   Sichtbar erst unterhalb des Breakpoints (siehe Media-Query unten). */
.app-header__burger {
    display: none;
    margin-left: auto;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 2.5rem;
    padding: 0;
    background: var(--color-surface-inner);
    border: 2px solid var(--color-heading);
    border-radius: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.app-header__burger-bars {
    position: relative;
    display: block;
    width: 1.15rem;
    height: 2px;
    background: var(--color-heading);
}
.app-header__burger-bars::before,
.app-header__burger-bars::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-heading);
}
.app-header__burger-bars::before { top: -6px; }
.app-header__burger-bars::after  { top: 6px; }
.app-header__burger-bars,
.app-header__burger-bars::before,
.app-header__burger-bars::after {
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.app-header__burger:hover,
.app-header__burger:focus-visible,
.app-header__burger[aria-expanded="true"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.app-header__burger:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.app-header__burger:hover .app-header__burger-bars,
.app-header__burger:hover .app-header__burger-bars::before,
.app-header__burger:hover .app-header__burger-bars::after,
.app-header__burger:focus-visible .app-header__burger-bars,
.app-header__burger:focus-visible .app-header__burger-bars::before,
.app-header__burger:focus-visible .app-header__burger-bars::after,
.app-header__burger[aria-expanded="true"] .app-header__burger-bars::before,
.app-header__burger[aria-expanded="true"] .app-header__burger-bars::after {
    background: var(--color-primary-contrast);
}
/* Offen: die drei Striche werden zum Kreuz. */
.app-header__burger[aria-expanded="true"] .app-header__burger-bars { background: transparent; }
.app-header__burger[aria-expanded="true"] .app-header__burger-bars::before { transform: translateY(6px) rotate(45deg); }
.app-header__burger[aria-expanded="true"] .app-header__burger-bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (prefers-reduced-motion: reduce) {
    .app-header__burger,
    .app-header__burger-bars,
    .app-header__burger-bars::before,
    .app-header__burger-bars::after { transition: none; }
}

/* ------------------------------------------------- Kopfzeile auf kleinen Geräten
   Unterhalb von 1100px passen die (in DE/EN teils langen) Menüpunkte nicht
   mehr in eine Zeile — ab hier übernimmt der Hamburger. Der Breakpoint steht
   auch in js/nav-toggle.js und muss dort mitgezogen werden. */
@media (max-width: 1099px) {
    .app-header__inner { padding: 0.75rem 1rem; gap: 0.75rem; }
    .app-header__burger { display: inline-flex; }

    .app-header__menu {
        display: none;
        position: absolute;
        z-index: 200;
        top: calc(100% + 0.5rem);
        right: 1rem;
        left: auto;
        flex: 0 0 auto;
        width: max-content;
        min-width: 13rem;
        max-width: calc(100vw - 2rem);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem;
        background: var(--color-surface);
        border: 2px solid var(--color-heading);
        border-radius: 1.1rem;
        box-shadow: 6px 6px 15px rgba(113, 136, 160, 0.35);
    }
    .app-header__menu.is-open { display: flex; }

    .app-header__nav { flex-direction: column; align-items: stretch; gap: 0; }
    .app-header__nav a {
        padding: 0.6rem 0.9rem;
        border-radius: var(--radius-md);
        font-size: 1.05rem;
        white-space: nowrap;
    }
    .app-header__nav a:hover { background: var(--color-surface-inner); color: var(--color-primary); }

    .app-header__spacer { display: none; }
    .app-header__account {
        margin-top: 0.4rem;
        padding: 0.7rem 0.9rem 0.2rem;
        border-top: 1px solid var(--color-border-muted);
        justify-content: space-between;
        gap: 1rem;
    }
}

.nav-top {
    display: flex; 
    gap: 0; 
    flex-wrap: wrap;
}
.nav-top .btn {
    border-radius: 0;
    border-left: none;
}
.nav-top .btn:first-child {
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}
.nav-top .btn:last-child {
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}
.flash-stack { max-width: 2000px; margin: 1rem auto 0; padding: 0 2rem; }
.flash {
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
    font-size: 0.92em;
}
.flash-success { background: var(--st-done-bg); color: var(--st-done-fg); border-color: #b7dfc1; }
.flash-warning { background: var(--st-pending-bg); color: var(--st-pending-fg); border-color: #ffe69c; }
.flash-danger  { background: var(--st-failed-bg); color: var(--st-failed-fg); border-color: #f1b0b7; }
.flash-info    { background: var(--st-running-bg); color: var(--st-running-fg); border-color: #b3d7ff; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.25rem;
    width: min(100%, 420px);
}
.login-card h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
.login-card .login-brand b { color: var(--color-primary); }
.login-card .lead { color: var(--color-muted); margin: 0 0 1.5rem; }

.about-dialog {
    border: 0; border-radius: 12px; padding: 0;
    max-width: 26rem; width: calc(100% - 2rem);
    box-shadow: 0 20px 60px rgba(18, 18, 18, 0.25);
}
.about-dialog::backdrop { background: rgba(18, 18, 18, 0.45); }
.about-dialog__body { position: relative; padding: 2rem 2.25rem; text-align: center; }
.about-dialog__close {
    position: absolute; top: 0.6rem; right: 0.85rem;
    background: none; border: 0; font-size: 1.5rem; line-height: 1;
    color: var(--color-muted); cursor: pointer;
}
.about-dialog__close:hover { color: var(--color-heading); }
.about-dialog__brand { font-weight: 900; font-size: 1.4rem; color: var(--color-heading); margin-bottom: 1rem; }
.about-dialog__brand b { color: var(--color-primary); }
.about-dialog__brand-logo { height: 30px; width: auto; display: block; margin: 0 auto 1rem; }
/* Wortmarke im Header: Höhe an die Schriftgröße gekoppelt, Seitenverhältnis aus dem SVG. */
.app-header__brand img { height: 1.05em; width: auto; display: block; }
.app-header__brand:hover img { opacity: 0.82; }
.login-card .login-brand img { height: 34px; width: auto; display: inline-block; }
.about-dialog__logo, .about-dialog .logo { width: 220px; max-width: 100%; height: auto; margin: 0 auto 1rem; display: block; }
.about-dialog__body h2 { font-size: 1.05rem; margin: 0 0 0.25rem; color: var(--color-heading); }
.about-dialog__claim { color: var(--color-muted); margin-bottom: 0.75rem; }
.about-dialog__body hr { border: 0; border-top: 1px solid var(--color-border-muted); margin: 1rem 0; }
.about-dialog__manual { margin: 1rem 0 0; }
.about-dialog__license { font-size: 0.85rem; color: var(--color-muted); margin: 0; }

/* Hinweise und Rückfragen (window.AicDialog) — ersetzt alert()/confirm(). */
.aic-dialog {
    border: 0; border-radius: var(--radius-lg); padding: 0;
    max-width: 30rem; width: calc(100% - 2rem);
    color: var(--color-text); background: var(--color-surface);
    box-shadow: 0 20px 60px rgba(18, 18, 18, 0.25);
}
.aic-dialog::backdrop { background: rgba(18, 18, 18, 0.45); }
.aic-dialog__body { padding: 1.5rem 1.75rem 1.25rem; }
.aic-dialog__title { font-size: 1.05rem; margin: 0 0 0.5rem; color: var(--color-heading); }
/* Meldungen bringen teils mehrere Zeilen mit (Feldfehler der API) — die
   Umbrüche müssen stehen bleiben, lange URLs dürfen den Dialog nicht sprengen. */
.aic-dialog__text {
    margin: 0; white-space: pre-line; overflow-wrap: anywhere;
    max-height: 60vh; overflow-y: auto;
}
.aic-dialog__input { width: 100%; margin: 0 0 0.75rem; }
.aic-dialog__actions {
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem;
    margin-top: 1.5rem;
}
/* Handbuch-Abschnitt (AicDialog.doc): breiter, mit Kapitel-Überzeile, Fließtext
   statt vorformatierter Meldung. Unten links der Zurück-Knopf (Navigation im
   Kapitel) und der Link auf die Handbuch-Seite, rechts Schließen. */
.aic-dialog--wide { max-width: 46rem; }
.aic-dialog__eyebrow {
    margin: 0 0 0.2rem; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--color-muted);
}
.aic-dialog__text--doc { white-space: normal; font-size: 0.95rem; line-height: 1.55; max-height: 70vh; outline: none; }
.aic-dialog__aside { display: flex; align-items: center; gap: 0.75rem; margin-right: auto; }
.aic-dialog__link { font-size: 0.9rem; }
/* Verweise im Handbuchtext und der Fußzeilen-Link sind als Links erkennbar */
:is(.aic-doc-body, .aic-dialog__text--doc) a, .aic-dialog__link { text-decoration: underline; text-underline-offset: 0.15em; text-decoration-color: var(--color-muted); }
:is(.aic-doc-body, .aic-dialog__text--doc) a:hover, .aic-dialog__link:hover { text-decoration-color: currentColor; }

/* Handbuch-HTML aus assets/help/*.json — im Dialog (.aic-dialog__text--doc) und auf
   der Handbuch-Seite (.aic-doc-body) gleich gesetzt. */
:is(.aic-doc-body, .aic-dialog__text--doc) p { margin: 0 0 0.8rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) ul, :is(.aic-doc-body, .aic-dialog__text--doc) ol { margin: 0 0 0.9rem; padding-left: 1.3rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) li { margin: 0.2rem 0; }
:is(.aic-doc-body, .aic-dialog__text--doc) code { font-size: 0.88em; }
:is(.aic-doc-body, .aic-dialog__text--doc) pre { margin: 0 0 0.9rem; padding: 0.6rem 0.8rem; overflow-x: auto; font-size: 0.85rem; background: rgba(127, 127, 127, 0.1); border-radius: var(--radius-lg); }
:is(.aic-doc-body, .aic-dialog__text--doc) .tablewrap { overflow-x: auto; margin: 0 0 1rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) th, :is(.aic-doc-body, .aic-dialog__text--doc) td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--color-border-muted); }
:is(.aic-doc-body, .aic-dialog__text--doc) th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-muted); font-weight: 500; }
:is(.aic-doc-body, .aic-dialog__text--doc) td:first-child { font-weight: 500; min-width: 8rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) aside { margin: 0.9rem 0; padding: 0.7rem 0.9rem 0.3rem; border-left: 3px solid var(--color-muted); background: rgba(127, 127, 127, 0.08); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
:is(.aic-doc-body, .aic-dialog__text--doc) aside.note { padding-bottom: 0.7rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) .example-label { display: block; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.3rem; }
:is(.aic-doc-body, .aic-dialog__text--doc) h4 { margin: 1rem 0 0.4rem; font-size: 1rem; }
/* Screenshots: auf der Handbuch-Seite als Abbildung mit Unterschrift, im Dialog ausgeblendet
   (dort sieht der Benutzer die Oberfläche selbst; ohne src wird auch nichts geladen). */
.aic-doc-body .doc-figure { margin: 1.2rem 0 1.6rem; }
.aic-doc-body .doc-figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--color-border); border-radius: 6px; background: #fff; }
.aic-doc-body .doc-figure figcaption { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.45rem; line-height: 1.45; }
.aic-dialog__text--doc .doc-figure { display: none; }

/* Handbuch-Seite (/help/{lang}): Kapitelliste links (haftend), alle Kapitel rechts. */
.aic-help { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.aic-help__toc {
    position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto;
    padding: 1rem 1.1rem; border: 1px solid var(--color-border); border-radius: 8px;
    background: var(--color-surface); font-size: 0.9rem;
}
.aic-help__brand { margin: 0 0 0.6rem; font-weight: 600; color: var(--color-heading); }
.aic-help__langs { display: flex; gap: 0.35rem; margin-bottom: 0.9rem; }
.aic-help__part { margin: 0.9rem 0 0.25rem; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-muted); }
.aic-help__toc nav a { display: block; padding: 0.18rem 0.4rem; border-radius: 4px; color: var(--color-text); text-decoration: none; }
.aic-help__toc nav a:hover, .aic-help__toc nav a:focus-visible { background: rgba(127, 127, 127, 0.12); }
.aic-help__main { max-width: 78ch; font-size: 0.97rem; line-height: 1.55; }
.aic-help__chapter { padding: 2rem 0 1rem; border-top: 3px solid var(--color-accent); margin-top: 2.5rem; scroll-margin-top: 1rem; }
.aic-help__chapter:first-child { margin-top: 0; }
.aic-help__eyebrow { margin: 0 0 0.3rem; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-muted); }
.aic-help__chapter h1 { margin: 0 0 1.2rem; font-size: 1.7rem; }
.aic-help__chapter h2 { margin: 2.2rem 0 0.7rem; font-size: 1.3rem; scroll-margin-top: 1rem; }
.aic-help__chapter h3 { margin: 1.6rem 0 0.5rem; font-size: 1.08rem; scroll-margin-top: 1rem; }
@media (max-width: 900px) {
    .aic-help { grid-template-columns: 1fr; }
    .aic-help__toc { position: static; max-height: none; }
}

/* i-Knopf: Erklärung aus dem Handbuch (help.js, data-aic-doc). Sitzt im Titel
   eines Akkordeons oder neben einer Überschrift; Klick öffnet den Abschnitt. */
.aic-doc-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.35rem; height: 1.35rem; margin-left: 0.4rem; padding: 0; border: 0;
    background: none; color: var(--color-muted); cursor: pointer; vertical-align: middle;
    border-radius: 50%;
}
.aic-doc-btn svg { width: 1.1rem; height: 1.1rem; }
.aic-doc-btn:hover, .aic-doc-btn:focus-visible { color: var(--color-heading); }

/* ============================================================================
   Seitenrahmen, Überschriften, Brotkrumen
   ========================================================================== */
/* Der linke Rand liegt immer auf der Kopfzeile: Seiten mit eigener,
   schmalerer max-width (Formulare, Listen) beginnen dadurch links bündig
   statt mittig — wie im TYPO3-Modul. */
.ai-connect-page {
    padding: 1.5rem 2rem;
    max-width: 2000px;
    margin-inline: max(0px, (100% - 2000px) / 2) auto;
}
.ai-connect-page h1 { margin: 0 0 .25rem; font-size: 1.6rem; font-weight: 600; }
.ai-connect-page h2 { margin: 1.5rem 0 .75rem; font-size: 1.2rem; font-weight: 600; }
.ai-connect-page h3 { font-size: 1rem; font-weight: 600; }
.lead { color: var(--color-muted); margin-bottom: 1.25rem; }
.muted { color: var(--color-muted); }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.meta { font-size: 0.85em; color: var(--color-muted); }
.desc { color: var(--color-text); font-size: 0.9em; margin-top: .15rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.section-h { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--color-border-muted); }

/* Brotkrumen (Markup nutzt „›" als Trenner) */
.crumb {
    color: var(--color-muted);
    font-size: 0.92em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.crumb a { color: #555; }
.crumb a:hover { color: #000; }

/* ============================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-heading);
    border-radius: var(--radius-lg);
    padding: 0.35rem 0.8rem;
    font: inherit;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.5;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; background: #f0f0f0; border-color: #a1a1a1; }
.btn-sm { padding: 0.2rem 0.55rem; font-size: 0.88em; }
.btn-default { background: var(--color-surface); color: var(--color-heading); }
.btn-aic, .btn-primary {
    background-color: var(--color-button);
    border-color: var(--color-button);
    color: var(--color-button-text);
}
.btn-aic:hover, .btn-aic:focus, .btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-button-hover);
    border-color: var(--color-button-hover);
    color: var(--color-button-text);
}
.btn-aic-light { background: var(--color-button); color: var(--color-button-text); border-color: var(--color-button); }
.btn-danger { background-color: #777777; border-color: #777777; color: #fff; }
.btn-danger:hover, .btn-danger:focus { background-color: #5f5f5f; border-color: #5f5f5f; color: #fff; }
.btn-link { background: none; border-color: transparent; color: var(--color-accent); }
.btn-link:hover { background: none; text-decoration: underline; }
/* Deaktiviert: eigene, flache Optik statt halbdurchsichtig. Ein schwarzer
   Knopf auf 50 % Deckkraft landete über den Listenzonen bei rund #747a80 —
   also praktisch beim Grau des aktiven „Löschen“-Knopfs, und man sah einem
   Knopf nicht mehr an, ob er wirkt. */
.btn:disabled,
.btn:disabled:hover,
.btn:disabled:focus {
    opacity: 1;
    background: var(--color-surface-inner);
    background-color: var(--color-surface-inner);
    border-color: var(--color-border);
    color: var(--color-muted);
    cursor: default;
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; }

/* ============================================================================
   Formulare
   ========================================================================== */
.form-control, .form-select {
    width: 100%;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font: inherit;
    color: var(--color-heading);
    background: var(--color-surface);
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(0, 120, 230, 0.18);
}
.form-control-sm, .form-select-sm { padding: 0.2rem 0.45rem; font-size: 0.88em; }
.form-label { font-weight: 600; margin-bottom: 0.25rem; display: block; }
.form-text { font-size: 0.85em; color: var(--color-muted); margin-top: 0.25rem; }
.form-group { margin-bottom: 1.1rem; }
.form-actions { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border-muted); display: flex; gap: 0.5rem; align-items: center; }
.required { color: #c4314b; }
.readonly-hint { color: var(--color-muted); font-size: 0.85em; }
.form-range { width: 100%; accent-color: var(--color-accent); }

/* Kästchen und Radios: rund 30 % größer als die Browser-Vorgabe (13px), im
   angehakten Zustand schwarz wie die Primär-Buttons. accent-color färbt die
   Fläche, das Häkchen setzt der Browser selbst auf Weiß. */
input[type="checkbox"],
input[type="radio"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0 0.2rem 0 0;
    accent-color: var(--color-button);
    vertical-align: -0.22em;
    cursor: pointer;
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled { cursor: default; }
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.single-url-form { display: flex; gap: 0.5rem; }
.single-url-form input { flex: 1; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin: 0.25rem 0 1.5rem; min-width: 0; }
fieldset > legend { float: none; width: auto; padding: 0 0.5rem; margin: 0; font-size: 0.95em; font-weight: 600; }

/* Bearbeiten-Formular der Sammlung: Abschnitte als Akkordeons (details/summary).
   Die ganze Titelzeile schaltet um, rechts ein Pfeil (▸ zu / ▾ offen); offen/zu merkt
   sich project-form.js je Redakteur, ein Sprungziel #setting-… öffnet seinen Abschnitt. */
details.aic-form-section { border: 1px solid var(--color-border); border-radius: 8px; padding: .65rem 1.1rem .95rem; margin: 0 0 .9rem; min-width: 0; background: var(--color-surface); }
details.aic-form-section > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: .5rem;
    margin: 0 0 1rem; padding: .15rem 0;
    font-size: 1.02rem; font-weight: 600; color: var(--color-heading);
    border-radius: 4px;
}
details.aic-form-section > summary::-webkit-details-marker { display: none; }
details.aic-form-section > summary::after {
    content: ''; flex: 0 0 auto; width: .5rem; height: .5rem; margin-left: auto; margin-right: .35rem;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-.1rem) rotate(-45deg); transition: transform .15s ease;
}
details.aic-form-section[open] > summary::after { transform: translateY(-.25rem) rotate(45deg); }
details.aic-form-section > summary:hover, details.aic-form-section > summary:focus-visible { color: var(--color-accent); }
details.aic-form-section:not([open]) { padding-bottom: .65rem; }
details.aic-form-section:not([open]) > summary { margin-bottom: 0; }
details.aic-form-section > :last-child { margin-bottom: 0; }
details.aic-form-section > summary .muted { font-weight: 400; font-size: .9em; }
details.aic-form-section .form-group:target { outline: 2px solid var(--color-accent); outline-offset: 8px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { details.aic-form-section > summary::after { transition: none; } }

/* Sprach-Reiter in Formularen */
.aic-lang-tabs { display: flex; gap: 0.25rem; }
.aic-lang-tabs .btn.active { background-color: var(--color-button); border-color: var(--color-button); color: var(--color-button-text); }
[data-aic-lang-pane][hidden] { display: none; }

/* ============================================================================
   Tabellen
   ========================================================================== */
.table, .docs-table, .jobs-table, .usage-table {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    border-collapse: collapse;
    overflow: hidden;
}
.table thead th, .docs-table thead th, .jobs-table thead th, .usage-table thead th {
    background: var(--color-surface);
    font-weight: 600;
    font-size: 0.92em;
    color: var(--color-heading);
    border-bottom: 1px solid var(--color-border);
    padding: 0.6rem 0.75rem;
    text-align: left;
}
.table tbody td, .docs-table tbody td, .jobs-table tbody td, .usage-table tbody td {
    padding: 0.55rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid var(--color-border-muted);
}
.table tbody tr:hover > td, .docs-table tbody tr.doc-row:hover > td { background: var(--color-surface-div); }
.usage-table thead th.num, .usage-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-table input { max-width: 120px; text-align: right; }
/* URL-Zelle: immer einzeilig, vorne gekürzt, volle Adresse per title.
   Vorher stand hier word-break:break-all — sobald die Spalte schmal wurde
   (Laptop-Breiten, seit die Navigationsschiene Platz nimmt), zerfiel die
   Adresse in Buchstabenkolonnen. Passt sie, ändert die Kürzung nichts. */
.url-cell { max-width: 260px; font-size: 0.85em; }
/* Erst wenn der Schirm es hergibt, darf die Adresse mehr Raum nehmen. Bei
   1134px (Laptop mit Navigationsschiene) sprengten 360px die Tabelle um
   gut 50px über ihren Container hinaus. */
@media (min-width: 1400px) { .url-cell { max-width: 420px; } }
.url-cell a { color: #555; }
.url-cell > a,
.url-cell > .url-trunc {
    display: block;
    direction: rtl;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.url-cell > a > bdi,
.url-cell > .url-trunc > bdi { direction: ltr; }

/* Vorschaubild in der Titelzelle — als Klasse statt inline, damit die
   Media-Query es auf schmalen Geräten vergrößern kann. Muss VOR den
   Media-Queries stehen, sonst gewinnt sie bei gleicher Spezifität. */
.doc-row-thumb {
    height: 28px; width: auto; vertical-align: middle; margin-right: 0.4rem;
    border: 1px solid #ddd; border-radius: 4px; background: #fff;
}

/* ============================================================================
   CAG-Karte — eigene Klassen statt Inline-Styles, damit die Media-Query unten
   überhaupt greifen kann (Inline schlägt jedes Stylesheet).
   ========================================================================== */
.cag-bundle-card__body {
    display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; margin-top: 1rem;
}
.cag-bundle-card__list { flex: 1 1 320px; min-width: 0; }
.cag-bundle-card__row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.cag-bundle-card__row + .cag-bundle-card__row { border-top: 1px solid #f5f0e6; }
.cag-bundle-card__info { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.cag-bundle-card__action { margin: 0; flex: 0 0 auto; }
.cag-bundle-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.cag-bundle-card__side-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cag-lang {
    background: #343a40; color: #fff; padding: 0.15rem 0.5rem; border-radius: 4px;
    font-size: 0.75em; font-weight: 700; letter-spacing: 0.05em;
    min-width: 2.4em; text-align: center; flex: 0 0 auto;
}
.cag-state {
    padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78em;
    font-weight: 600; white-space: nowrap; flex: 0 0 auto;
}
.cag-state--ready { background: #d4edda; color: #155724; }
.cag-state--large { background: #fff3cd; color: #856404; }
.cag-state--empty { background: #f8d7da; color: #721c24; }
.cag-state--none  { background: #eef0f2; color: #555; }

/* Schmale Geräte: Kennung + Zustand bleiben nebeneinander, Text und Knopf
   rutschen darunter — sonst quetscht die 320px-Grundbreite die Karte auf. */
@media (max-width: 760px) {
    .cag-bundle-card__body { gap: 0.75rem; }
    .cag-bundle-card__list { flex-basis: 100%; }
    .cag-bundle-card__row { flex-wrap: wrap; align-items: center; }
    .cag-bundle-card__info { flex-basis: 100%; }
    .cag-bundle-card__action { width: 100%; }
    .cag-bundle-card__action > .btn { width: 100%; }
    .cag-bundle-card__side { align-items: stretch; width: 100%; }
    .cag-bundle-card__side-row > form { flex: 1 1 12rem; }
    .cag-bundle-card__side-row > form > .btn { width: 100%; }
}

/* ============================================================================
   Dokumentliste auf schmalen Geräten

   Feste Tabellenbreite statt Inhaltsbreite: sonst sprengt eine lange URL die
   Tabelle über den Sichtbereich hinaus. Die URL bekommt den größten Anteil und
   wird VORNE gekürzt — der Dateiname am Ende ist die nützliche Information.
   ========================================================================== */
@media (max-width: 700px) {
    .docs-table { table-layout: fixed; }
    /* Enger polstern: 0.75rem je Seite sind bei fünf Spalten auf 375px allein
       7,5 rem Rand — die fehlen dem Inhalt. */
    .docs-table th, .docs-table td { overflow-wrap: anywhere; padding-inline: 0.4rem; }
    /* Auswahl und Aktiv: nur so breit wie das Kästchen */
    .docs-table thead th:nth-child(1),
    .docs-table thead th:nth-child(2) { width: 2.4rem; padding-inline: 0.35rem; }
    .docs-table tbody td:nth-child(1),
    .docs-table tbody td:nth-child(2) { padding-inline: 0.35rem; }
    .docs-table thead th:last-child { width: 2.9rem; }

    /* Kürzung selbst steht in der Grundregel; hier fällt nur die Deckelung. */
    .url-cell { max-width: none; }

    /* Bei table-layout:fixed nimmt der Browser die Inline-Breite „1%“ wörtlich;
       auf dem Desktop (table-layout:auto) heißt sie „so schmal wie der Inhalt“.
       Ohne feste Werte schrumpfte „Status“ auf wenige Pixel und bräche
       buchstabenweise um — daher hier je Tabellenart echte Breiten. */
    /* Alle Breiten als Prozent, damit sie sich zu 100 % addieren: bei
       table-layout:fixed teilt der Browser sonst den Rest unter „auto“-Spalten
       auf, und eine überbestimmte Zeile drückt den Titel auf wenige Pixel. */
    .docs-table thead th:nth-child(1),
    .docs-table thead th:nth-child(2) { width: 8% !important; }
    .docs-table--web thead th:nth-child(3) { width: 35% !important; }
    .docs-table--web thead th:nth-child(4) { width: 25% !important; }
    .docs-table--web thead th:nth-child(5) { width: 13% !important; }
    .docs-table--web thead th:nth-child(6) { width: 11% !important; }

    .docs-table--files thead th:nth-child(3) { width: 58% !important; }
    .docs-table--files thead th:nth-child(5) { width: 15% !important; }
    .docs-table--files thead th:nth-child(7) { width: 11% !important; }

    /* Nur „Typ“ und „Tokens“ der Dateiliste weichen — die Einzel-Löschen-Spalte
       bleibt, sie ist der einzige Weg, eine Zeile ohne Umweg zu entfernen. */
    .docs-table--files thead th:nth-child(4),
    .docs-table--files tbody tr.doc-row > td:nth-child(4),
    .docs-table--files thead th:nth-child(6),
    .docs-table--files tbody tr.doc-row > td:nth-child(6) { display: none; }

    /* Vorschaubilder dreifach so hoch (28px → 84px). Über die Breite ginge das
       nicht: ein 16:10-Bild bräuchte dafür 134px Spalte, die der URL fehlten.
       Deshalb feste Höhe mit Zuschnitt — object-position:top, weil bei
       Seiten-Screenshots der Kopf das Wiedererkennungsmerkmal ist. Das
       vollständige Bild steht weiterhin im aufgeklappten Detailbereich. */
    .doc-row-thumb {
        display: block;
        width: 100%;
        height: 84px;
        object-fit: cover;
        object-position: top;
        margin: 0 0 0.35rem;
    }

    /* Kästchen- und Löschspalte polstern enger, damit die Prozente aufgehen. */
    .docs-table tbody tr.doc-row > td:nth-child(1),
    .docs-table tbody tr.doc-row > td:nth-child(2) { padding-inline: 0.25rem; }
    .docs-table tbody tr.doc-row > td:last-child { padding-inline: 0.2rem; }
    .docs-table tbody tr.doc-row > td:last-child .btn { padding-inline: 0.35rem; }

    /* Die Statuszelle trägt ihr nowrap inline — auf schmalen Spalten liefe die
       Plakette sonst über den Rand hinaus. Die Plakette selbst darf aber NICHT
       buchstabenweise brechen, sie ist ein Wort. */
    .docs-table tbody tr.doc-row > td[style*="nowrap"] { white-space: normal !important; }
    .docs-table .doc-status {
        overflow-wrap: normal;
        word-break: keep-all;
        white-space: nowrap;
        font-size: 0.72em;
        padding-inline: 0.4rem;
    }
    .docs-table tbody tr.doc-row > td[style*="nowrap"] { padding-inline: 0.25rem; }
}

/* Unter 480px reicht der Platz auch für die verkleinerte Plakette nicht mehr —
   die Statusfarbe trägt dann die Schrift selbst, ohne Fläche und Polsterung. */
@media (max-width: 480px) {
    .docs-table--web thead th:nth-child(5) { width: 20% !important; }
    .docs-table--files thead th:nth-child(5) { width: 20% !important; }
    .docs-table .doc-status {
        background: none;
        padding: 0;
        font-size: 0.7em;
        font-weight: 600;
    }

    /* Die Beschriftungen „PROC.“/„ACTIVE“ passen bei dieser Spaltenbreite nicht
       mehr in eine Zeile und brächen sonst buchstabenweise um. Was die Spalten
       bedeuten, sagt das title-Attribut der Kopfzelle. */
    .docs-table thead th .col-caption { display: none; }

    /* Letzte Rettung, falls eine Zelle doch breiter baut als gedacht. */
    .aic-list, .aic-tab-panel > .aic-actions { max-width: 100%; }
    .aic-list .docs-table { display: table; }
}

/* Seitenränder auf schmalen Geräten: 2rem links und rechts fressen auf einem
   375px-Gerät ein Sechstel der Breite — die geht besser in die Liste. */
@media (max-width: 760px) {
    .ai-connect-page { padding: 1rem 0.75rem; }
    .flash-stack { padding: 0 0.75rem; }
    .aic-tab-panel .aic-actions, .aic-tab-panel .aic-list { padding: 0.75rem; }
    /* Die Aktionsgruppe rechts hängt im Template an margin-left:auto — in einer
       umgebrochenen Zeile erzeugt das nur eine Lücke. */
    .docs-toolbar > div[style] { margin-left: 0 !important; }
}
.domain-list { font-size: 0.9em; line-height: 1.5; word-break: break-all; }
.llm-cell .provider { text-transform: capitalize; }
.llm-cell .model { color: var(--color-muted); font-size: 0.85em; }
.progress-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Zebra: jede zweite Dokumentzeile (die versteckten Detailzeilen verbieten ein
   reines nth-child-Muster, daher setzt das Template die Klasse). */
.docs-table tr.doc-row--alt > td { background: rgba(0, 0, 0, 0.04); }
.docs-table tr.doc-detail-row > td { background: var(--color-surface-body); }
.aic-list .doc-row.doc-row-open td { 
    background: var(--color-surface-head);
    color: var(--color-primary-contrast);
}
.aic-list .doc-row.doc-row-open td:first-child {
    border-left: 3px solid var(--color-surface-head);
}
.aic-list .doc-row.doc-row-open td:last-child {
    border-right: 3px solid var(--color-surface-head);
}
.aic-list .doc-row.doc-row-open:hover > td {
    background: var(--color-surface-head-hover);
}
.aic-list .doc-row.doc-row-open td .muted {
    color: var(--color-primary-contrast);
}
.aic-list .doc-row.doc-row-open td.url-cell a {
    color: var(--color-primary-contrast);
}
.aic-list tr.doc-detail-row td {
    border-left: 3px solid var(--color-surface-head);
    border-right: 3px solid var(--color-surface-head);
    border-bottom: 7px solid var(--color-surface-head);
}
/* ============================================================================
   Karten & Zonen
   ========================================================================== */
.action-card, .info-card, .filetypes-card, .form-card, .task-card,
.example-card, .suggest-card, .cag-bundle-card, .zone {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: none;
}
.form-card { padding: 1.5rem 1.75rem; }
.action-card p { color: var(--color-muted); font-size: 0.9em; margin: 0 0 0.75rem; }
.action-card h3 { margin: 0 0 0.5rem; }
.filetypes-label { font-weight: 600; font-size: 0.9em; margin-bottom: 0.4rem; }
.filetypes-grid { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.filetype { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92em; cursor: pointer; }
.info-card dt { font-size: 0.8em; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem; }
.info-card dt:first-child { margin-top: 0; }
.info-card dd { margin: 0.15rem 0 0.5rem; word-break: break-all; }
.aic-subaction { border-top: 1px solid var(--color-border-muted); margin-top: 1rem; padding-top: 1rem; }
.aic-subaction:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.aic-subaction h3 { font-size: 1rem; font-weight: 600; margin: 0 0 0.5rem; }
.aic-subaction p { color: var(--color-muted); font-size: 0.9em; margin: 0 0 0.75rem; }

.empty-state {
    background: var(--color-surface);
    border: 1px dashed #d0d0d0;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    color: var(--color-muted);
}

/* Kopfband der Sammlungsansicht — Titel und Kennungen stehen auf einer Zeile,
   senkrecht mittig; die Eigenabstände von h1 und .crumb werden dafür
   zurückgesetzt, sonst schöbe sich das Band nach unten aus der Mitte. */
.aic-nav {
    background: var(--color-surface-contrast) !important;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg) !important;
    padding: 1rem 1.25rem !important;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}
.aic-nav h1 { margin: 0; }
.aic-nav .crumb { margin: 0; gap: 0.75rem; }
/* Bereichsname neben dem Sammlungsnamen — bewusst KEINE zweite Überschrift,
   damit je Seite nur eine h1 steht. Der Haken davor trennt beide optisch. */
.aic-nav__section {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.aic-nav__section::before {
    content: '›';
    font-size: 1.2em;
    color: var(--color-border);
}

/* ============================================================================
   Navigationsschiene der Sammlungsansicht

   Die Bereiche der Sammlung stehen senkrecht links und bleiben beim Scrollen
   stehen; darunter Sprachwahl und Antwort-Cache. Unterhalb des Breakpoints
   (identisch zur Kopfzeile) klappt die Schiene in eine waagerechte Reihe über
   dem Inhalt — ein festes Seitenband wäre auf dem Telefon nur im Weg.
   ========================================================================== */
.ai-connect-page--rail {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}
.aic-rail {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.aic-rail__nav { display: flex; flex-direction: column; gap: 0.15rem; }
.aic-rail__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-weight: 500;
    line-height: 1.3;
}
.aic-rail__item:hover,
.aic-rail__item:focus-visible {
    background: var(--color-surface-inner);
    color: var(--color-primary);
    text-decoration: none;
}
/* Erster Punkt: zurück zur Sammlungsübersicht — er ersetzt die früheren
   „← Sammlung“-Krumen der Unterseiten und ist deshalb abgesetzt. */
.aic-rail__item--home {
    font-weight: 600;
    margin-bottom: 0.35rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--color-border-muted);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.aic-rail__item.is-active {
    background: var(--color-surface-alt);
    color: var(--color-heading);
    font-weight: 600;
}
.aic-rail__foot {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--color-border-muted);
}
.aic-rail__group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 0 0.7rem;
}
.aic-rail__label { color: var(--color-muted); font-size: 0.85em; }
.aic-lang-btns { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.aic-rail__cache { display: inline-flex; align-items: center; gap: 0.45rem; }

@media (max-width: 1099px) {
    .ai-connect-page--rail { display: block; }
    .aic-rail {
        position: static;
        max-height: none;
        overflow: visible;
        margin-bottom: 1rem;
    }
    .aic-rail__nav { flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
    .aic-rail__item { border: 1px solid var(--color-border); }
    /* In der Reihe trennt ein Abstand rechts, keine Linie darunter. */
    .aic-rail__item--home {
        margin: 0 0.5rem 0 0;
        padding-bottom: 0.5rem;
        border-bottom-color: var(--color-border);
        border-radius: var(--radius-md);
    }
    .aic-rail__foot {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Statistik-Kacheln */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.stat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 0.75rem 1rem; }
.stat .label { color: var(--color-muted); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-top: 0.25rem; color: var(--color-heading); }

/* Assistenten-/Werkzeug-Karten */
.task-list { display: grid; gap: 0.6rem; }
.task-card { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem 1rem; align-items: center; }
.task-card h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.task-card h3 a { color: var(--color-heading); }
.task-card h3 a:hover { color: var(--color-accent); }
.task-card .goal { color: var(--color-muted); font-size: 0.9em; margin-top: 0.35rem; white-space: pre-wrap; }
.task-card .meta { text-align: right; white-space: nowrap; }
.goal-card { background: var(--color-surface); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin: 1rem 0 1.5rem; white-space: pre-wrap; }

/* ============================================================================
   Akkordeons — Kopfzeile als Flex-Zeile mit Caret rechts (wie TYPO3-Panels)
   ========================================================================== */
details.aic-accordion > summary,
details.action-card > summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}
details.aic-accordion > summary::-webkit-details-marker,
details.action-card > summary::-webkit-details-marker { display: none; }
details.aic-accordion > summary:hover,
details.action-card > summary:hover { text-decoration: underline; }
details.aic-accordion > summary::after,
details.action-card > summary::after {
    content: '';
    flex-shrink: 0;
    margin-inline-start: auto;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='m4.464 6.05-.707.707L8 11l4.243-4.243-.707-.707L8 9.586z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='m4.464 6.05-.707.707L8 11l4.243-4.243-.707-.707L8 9.586z'/%3E%3C/svg%3E");
    -webkit-mask-position: center center; mask-position: center center;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: contain; mask-size: contain;
    rotate: -90deg;
    transition: rotate 0.25s ease-in-out;
}
details.aic-accordion[open] > summary::after,
details.action-card[open] > summary::after { rotate: 0deg; }
/* Zeilen mit eigenem rechtsbündigem Element brauchen keinen zweiten auto-Rand */
details > summary:has(.usage-day-cost)::after { margin-inline-start: 0; }
details.action-card[open] > summary { margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-border-muted); }

@media (prefers-reduced-motion: reduce) {
    details > summary::after { transition: none; }
}

/* Quellen-Übersicht: runder Info-Schalter, schwebt über der Reiterleiste */
details.aic-overview {
    position: absolute;
    top: -36px;
    right: 0;
    margin: 0 0 0.75rem;
    z-index: 10;
    text-align: right;
}
details.aic-overview > summary {
    cursor: pointer; list-style: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 50%;
    border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-muted);
}
details.aic-overview > summary::after { content: none; }
details.aic-overview > summary::-webkit-details-marker { display: none; }
details.aic-overview > summary:hover, details.aic-overview[open] > summary { color: #000; border-color: #a1a1a1; }
details.aic-overview .aic-overview-body {
    text-align: left;
    background: var(--color-surface-transparent);
    padding: 1rem;
    border-radius: var(--radius-lg);
}

/* ============================================================================
   Reiter je Datenquelle + Aktions-/Listenzone
   ========================================================================== */
.aic-tabs { display: flex; flex-wrap: wrap; gap: 0.15rem; margin: 0; }
.aic-tab {
    background: transparent;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0.4rem 0.9rem;
    margin-bottom: -1px;
    cursor: pointer;
    font: inherit;
    color: var(--color-text);
}
.aic-tab:hover { background: var(--color-surface-alt); }
.aic-tab.active {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
    border-bottom-color: var(--color-surface-alt);
    font-weight: 600;
}
.aic-tab-panel[hidden] { display: none; }
.aic-tab-panel .aic-actions {
    position: relative;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}
.aic-tab-panel .aic-list {
    margin-top: 1rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}
.aic-list h2 { margin-top: 0; }

/* ============================================================================
   Pills, Badges, Statusanzeigen
   ========================================================================== */
.type-pill, .schema-pill, .status-badge, .doc-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.8em;
    font-weight: 600;
    background: #ffffff;
    color: #555;
}
.schema-pill { font-family: var(--font-mono); font-weight: 400; }

/* Sammlungsname in der Übersicht: als Schaltfläche mit Ordner-Symbol, wie der
   erste Punkt der Navigationsschiene — sie ist der Einstieg in die Sammlung. */
.collection-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    font-weight: 600;
    color: var(--color-heading);
}
.collection-link:hover,
.collection-link:focus-visible { color: var(--color-primary); }
.collection-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-danger { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.ro-pill { display: inline-block; padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.8em; background: #e6f3ea; color: #1f7a44; }
.wr-pill { display: inline-block; padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.8em; background: #fdecea; color: #b02a37; }
.key-set { color: #1f7a44; font-size: 0.85em; white-space: nowrap; }
.key-unset { color: #b02a37; font-size: 0.85em; white-space: nowrap; }

/* LLM-Konfigurationen: die Modell-Spalte trug „Chat: …“ und „Embedding: …“
   umbrechend — bei zwei Modellnamen je Zeile wurde sie dadurch unlesbar
   schmal. Modellnamen bleiben zusammen, dafür darf die Endpunkt-Adresse
   der ersten Spalte kürzen; sie steht ohnehin im title. */
/* Modellnamen nie mitten im Wort trennen. Das nowrap gilt erst ab 1100px —
   darunter fehlt schlicht der Platz, und eine nicht schrumpfbare Spalte
   schöbe die Tabelle über den Sichtbereich hinaus. */
.llm-models { overflow-wrap: normal; word-break: normal; }
@media (min-width: 1100px) { .llm-models { white-space: nowrap; } }
.llm-endpoint {
    display: inline-block;
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
@media (max-width: 1099px) { .llm-endpoint { max-width: 11rem; } }

.status-pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.status-running { background: var(--st-running-bg); color: var(--st-running-fg); }
.status-done    { background: var(--st-done-bg);    color: var(--st-done-fg); }
.status-failed  { background: var(--st-failed-bg);  color: var(--st-failed-fg); }
.status-cancelled { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }

.doc-status { font-weight: 500; font-size: 0.78em; }
.doc-status-uploaded { background: #ede7f6; color: #5e35b1; }
.doc-status-crawled { background: #e7e9ec; color: #495057; }
.doc-status-indexed, .doc-status-unchanged { background: var(--st-done-bg); color: var(--st-done-fg); }
.doc-status-failed { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.doc-status-skipped, .doc-status-empty, .doc-status-type-skipped { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.doc-status-media-pending { background: var(--st-running-bg); color: var(--st-running-fg); }
.doc-status-busy { background: #fff3e0; color: #e65100; animation: aic-busy-pulse 1.6s ease-in-out infinite; }
@keyframes aic-busy-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.active-badge { margin-left: 0.4rem; background: var(--color-accent); color: #fff; padding: 0.1rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.7em; }

/* Frische-Wächter: Ampelpunkt neben dem Status */
.aic-fresh { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: .4rem; vertical-align: middle; }
.aic-fresh-ok { background: #34a853; }
.aic-fresh-changed { background: #f9ab00; }
.aic-fresh-dead { background: #ea4335; }
.aic-fresh-error { background: #f9ab00; box-shadow: inset 0 0 0 2px #ea4335; }
.aic-fresh-skipped { background: #dadce0; }

/* Sprach-Kennzeichen der Dokumentlisten: "übersetzt aus …" an Übersetzungs-
   kopien, "Übersetzung empfohlen: …" an Dateien, deren verweisende Seiten
   Sprachen ohne eigene Zeile haben. Sitzen neben Status-Pill + Frische-Punkt. */
.aic-langtag { display: inline-block; margin-left: 0.4rem; padding: 0 0.5em; border-radius: 9px; font-size: 0.72em; line-height: 1.7; vertical-align: middle; white-space: nowrap; font-weight: 600; }
.aic-langtag-copy { background: #e8f0fe; color: #1a56db; }
.aic-langtag-reco { background: #fef3c6; color: #92400e; }

.failures-trigger, .skips-trigger {
    background: none; border: none; padding: 0; cursor: pointer;
    font: inherit; text-decoration: underline; text-decoration-style: dotted;
}
.failures-trigger { color: #c4314b; }
.failures-trigger:hover { color: #8b1f33; }
.skips-trigger { color: #8a6d3b; margin-left: 0.4rem; }
.skips-trigger:hover { color: #5c4826; }

/* ============================================================================
   Dokumentliste: Werkzeugleiste, Suche, Blätterung
   ========================================================================== */
.docs-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
/* Zusammengeklappte Zweitleiste unter der Toolbar (Aufräumen, Prüfen, Übersetzen, OCR nachholen) */
.docs-toolbar-more { margin: -0.25rem 0 0.75rem; padding: 0.45rem 0.75rem; }
.docs-toolbar-more > summary { font-size: 0.9em; }
.docs-toolbar-more-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.docs-toolbar-more-row form { margin: 0; }
.aic-search { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 0.75rem; }
.aic-search input[type="text"] { flex: 1; min-width: 220px; max-width: 480px; }
.aic-search-opt { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9em; margin: 0; cursor: pointer; user-select: none; }
.aic-search-opt input { margin: 0; }
.aic-pager { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding: 0.4rem 0; font-size: 0.9em; color: #555; }
.aic-pager:empty { display: none; }
.aic-pager button { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.2rem 0.6rem; cursor: pointer; font: inherit; color: #333; }
.aic-pager button:hover:not(:disabled) { border-color: #a1a1a1; color: #000; }
.aic-pager button:disabled { opacity: 0.45; cursor: default; }
.aic-pager button.is-current { background: var(--color-button); border-color: var(--color-button); color: var(--color-button-text); cursor: default; }
.aic-pager .aic-pager-info { margin-right: 0.3rem; font-weight: 600; }
.aic-pager.is-loading { opacity: 0.5; pointer-events: none; }

.doc-row-toggle { cursor: pointer; }
.doc-details-toggle { white-space: nowrap; }
/* Bewusst inline und nicht inline-flex: als Flex-Element ignoriert das
   Kästchen darin das vertical-align aus der Formular-Grundregel und stünde
   knapp 3px höher als das Auswahlkästchen der Nachbarzelle. */
.active-toggle-form { display: inline; }
input.aic-pending { opacity: 0.5; cursor: progress; }
tr.doc-row-busy > td { opacity: 0.5; }
tr.doc-row-busy .doc-row-toggle { cursor: progress; }

/* Riegel je Datensatz: Der Knopf trägt beide Schlösser, sichtbar ist je nach
   Zeilenzustand genau eines — so braucht das Umschalten kein neues Icon vom
   Server, nur die Klasse an der Zeile. */
.doc-lock-btn .doc-lock-btn__on,
.doc-lock-btn .doc-lock-btn__off { display: inline-flex; align-items: center; }
.doc-lock-btn .doc-lock-btn__on { display: none; }
tr.doc-row--locked .doc-lock-btn .doc-lock-btn__on { display: inline-flex; }
tr.doc-row--locked .doc-lock-btn .doc-lock-btn__off { display: none; }

/* Schloss und Papierkorb sitzen in einer Zeile: gleiche Höhe, gleiche
   Grundlinie. Ohne diese Regeln richtete sich jeder Knopf nach seinem eigenen
   Inhalt aus (Icon-Span vs. Formular) und beide standen versetzt. */
.doc-actions-cell { white-space: nowrap; }
.doc-actions-cell > form { display: inline-flex; margin: 0; }
.doc-actions-cell .btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; line-height: 1; }
.doc-actions-cell .btn + .btn,
.doc-actions-cell .btn + form,
.doc-actions-cell form + .btn { margin-left: 0.25rem; }

tr.doc-row--locked > td { background: #fff8e1; }
.docs-table tr.doc-row--locked.doc-row--alt > td { background: #fdf3d3; }
/* Eigene Hover-Farbe: Der Riegel bleibt beim Überfahren sichtbar, die Zeile
   hebt sich aber trotzdem ab. */
.docs-table tr.doc-row--locked:hover > td,
.docs-table tr.doc-row--locked.doc-row--alt:hover > td { background: #ffe6a3; }
.doc-locked-note { display: flex; align-items: center; gap: 0.5rem; background: #fff8e1; border: 1px solid #ffe082; border-radius: 2px; padding: 0.5rem 0.75rem; font-size: 0.9em; margin: 1rem 1.25rem -0.25rem; }
/* display:flex schlägt sonst das hidden-Attribut — der Hinweis bliebe nach
   dem Entsperren stehen. */
.doc-locked-note[hidden] { display: none; }

/* Laufende Jobs: die Kopfzeile trägt den Live-Hinweis (auch im zugeklappten
   Akkordeon sichtbar), die laufende Zeile selbst wird hervorgehoben. Beides
   verschwindet von allein, sobald der Poll eine Liste ohne offene Jobs holt. */
.aic-job-live {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: #cce5ff; color: #004085; border-radius: var(--radius-sm);
    padding: 0.1rem 0.5rem; font-size: 0.78em; font-weight: 600;
}
.aic-job-live__dot {
    width: 8px; height: 8px; border-radius: 50%; background: #004085;
    animation: aic-busy-pulse 1.4s ease-in-out infinite;
}
.jobs-table tr.aic-job-row-running > td { background: #f2f8ff; }
.jobs-table tr.aic-job-row-running .status-badge { animation: aic-busy-pulse 1.4s ease-in-out infinite; }
tr.doc-row--changed > td { background: #fff8e1 !important; }
.doc-changed-badge { display: inline-block; margin-right: 0.4rem; font-size: 0.7em; font-weight: 700; text-transform: uppercase; padding: 0.05rem 0.4rem; border-radius: var(--radius-sm); background: #e8870b; color: #fff; vertical-align: middle; }
.docs-table tr.aic-row-processing td { background: #fff7e6 !important; }
.docs-table tr.aic-row-processing td:first-child::before {
    content: ''; display: inline-block; width: 10px; height: 10px;
    border: 2px solid #ddd; border-top-color: var(--color-accent); border-radius: 50%;
    animation: aic-spin 0.8s linear infinite; vertical-align: middle; margin-right: 0.4rem;
}
.docs-table tr.aic-row-success td { background: #e8f7ee !important; transition: background 1s ease; }
.docs-table tr.aic-row-error td { background: #fdeceb !important; }
@keyframes aic-spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Dokument-Detailbereich (Bearbeiten, Vergleich, Verzeichnisbaum)
   ========================================================================== */
.doc-detail-pane { padding: 0; background: var(--color-surface-body); }
.doc-edit-form { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.doc-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.doc-edit-form .form-label { font-weight: 500; margin-bottom: 0.3rem; display: block; }
.doc-edit-form textarea.form-control { max-height: 60vh; overflow: auto; resize: vertical; }
.doc-figure-link, .doc-download, .doc-edit-grid { border-bottom: 1px solid var(--color-surface-div); padding-bottom: 1rem; }

/* Download/Austausch links, die Bild-Bedeutung rechts daneben — auf schmalen
   Fenstern rutscht sie unter die Knöpfe. Sie steuert, wie bereitwillig ein
   Bild im Chat gezeigt wird, schließt aber nie eines aus. */
.doc-download {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.doc-relevance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-inline-start: auto;
}
.doc-relevance label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    white-space: nowrap;
}
@media (max-width: 700px) {
    .doc-relevance {
        margin-inline-start: 0;
        flex-basis: 100%;
    }
}


/* Der Detailbereich liegt auf einer dunkleren Fläche als der Rest der Seite;
   dort steht die Schrift in reinem Schwarz. */
.doc-detail-pane,
.doc-detail-pane .form-label,
.doc-detail-pane .muted,
.doc-detail-pane .form-control,
.doc-detail-pane .form-select { color: #000; }

/* Verknüpfungen: alle Zeilen teilen sich EIN Raster, damit die „Lösen“-Knöpfe
   untereinander stehen — auch wenn die Titel unterschiedlich lang sind.
   display:contents hebt die Zeilen-DIVs auf, ihre drei Kinder werden selbst
   zu Rasterzellen. */
.doc-figure-link {
    display: grid;
    grid-template-columns: max-content max-content 1fr;
    gap: 0.4rem 0.6rem;
    align-items: center;
}
[data-aic-link-row] { display: contents; }
[data-aic-link-row] > .btn { justify-self: start; }

/* Eingabefeld für den Elterndatensatz: gleiches Spaltenraster wie
   .doc-edit-grid, damit es exakt so breit ist wie das Titel-Feld darunter.
   auto-fill statt auto-fit — leere Spuren müssen erhalten bleiben, sonst
   dehnte sich das einzelne Feld über die volle Breite. */
[data-aic-link-add] {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0 0.75rem;
    align-items: center;
}
[data-aic-link-add] > .form-label { grid-column: 1 / -1; margin: 0 0 0.3rem; }
[data-aic-link-add] > .form-control { grid-column: 1; }
[data-aic-link-add] > .doc-link-aside {
    grid-column: 2 / -1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.9em;
}
.doc-meta-readonly {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.4rem 1rem; background: var(--color-surface); border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.85em;
}
.doc-error { background: #fdecee; color: #721c24; border: 1px solid #f5c6cb; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.85em; }
.doc-lang-detect { padding: 0.5rem 0; }
.doc-lang-mismatch { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; background: #fff8e1; border: 1px solid #ffe082; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.9em; }
.doc-lang-ok { background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.9em; }
/* stretch statt center: Knöpfe und die zusammengefassten Auswahl-Paare
   („Als Kopie übersetzen“, „In Sammlung kopieren“) bekommen so alle die
   Höhe des größten Elements der Zeile. */
.doc-edit-actions { display: flex; align-items: stretch; gap: 0.5rem; flex-wrap: wrap; }
.doc-edit-reload { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0 0.75rem; flex-wrap: wrap; }
.doc-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.doc-compare__col { min-width: 0; }
.doc-compare__label { font-weight: 600; font-size: 0.85em; margin-bottom: 0.5rem; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm); background: #eef1f4; }
.doc-compare__col:nth-child(2) .doc-compare__label { background: #fff3e0; color: #8a5a00; }
@media (max-width: 1100px) { .doc-compare { grid-template-columns: 1fr; } }
.doc-diff { grid-column: 1 / -1; margin-top: 0.5rem; border-top: 1px solid var(--color-border-muted); padding-top: 0.75rem; }
.doc-diff__bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.doc-diff__list { display: flex; flex-direction: column; gap: 0.5rem; }
.doc-diff__card { border: 1px solid #e3e3e3; border-left-width: 3px; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; background: var(--color-surface); }
.doc-diff__card--insert { border-left-color: #2e9e54; }
.doc-diff__card--delete { border-left-color: #d33; }
.doc-diff__card--replace { border-left-color: #e8870b; }
.doc-diff__card.is-done, .doc-diff__card.is-skipped { opacity: 0.55; }
.doc-diff__head { font-weight: 600; font-size: 0.9em; margin-bottom: 0.35rem; }
.doc-diff__badge { display: inline-block; font-size: 0.72em; padding: 0.05rem 0.45rem; border-radius: var(--radius-sm); background: #f0f0f0; color: #555; font-weight: 700; text-transform: uppercase; }
.doc-diff__body { font-family: var(--font-mono); font-size: 0.82em; white-space: pre-wrap; word-break: break-word; }
.doc-diff__old { color: #b00020; }
.doc-diff__new { color: #2e7d32; }
.doc-diff__actions { margin-top: 0.5rem; display: flex; gap: 0.4rem; align-items: center; }
.doc-diff__ok { color: #2e7d32; font-size: 0.85em; font-weight: 600; }
.doc-diff__fail { color: #b00020; font-size: 0.85em; }

.aic-dirtree { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; margin-top: 0.5rem; max-height: 420px; overflow: auto; font-size: 0.9em; }
.aic-dirtree-list { list-style: none; margin: 0; padding: 0 0 0 1.4rem; }
.aic-dirtree > .aic-dirtree-list { padding-left: 0; }
.aic-dirtree-row { display: flex; align-items: center; gap: 0.35rem; padding: 0.12rem 0.25rem; border-radius: var(--radius-sm); white-space: nowrap; }
.aic-dirtree-row:hover { background: #f2f5f9; }
.aic-dirtree-row input { margin: 0; }
.aic-dirtree-toggle { background: none; border: none; cursor: pointer; padding: 0; width: 1.1em; flex: 0 0 auto; color: #666; font-size: 0.85em; line-height: 1; }
.aic-dirtree-spacer { cursor: default; }
.aic-dirtree-node.aic-collapsed > .aic-dirtree-list { display: none; }
.aic-dirtree-badge { margin-left: 0.5rem; padding: 0.05rem 0.45rem; border-radius: var(--radius-sm); background: #e7e9ec; color: #495057; font-size: 0.72em; white-space: nowrap; vertical-align: middle; }

/* Web-Quellen-Editor */
.aic-ws-list { list-style: none; margin: 0 0 0.75rem; padding: 0; counter-reset: aic-ws; }
.aic-ws-card { counter-increment: aic-ws; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; margin-bottom: 0.6rem; background: var(--color-surface); }
.aic-ws-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.aic-ws-title { font-weight: 600; }
.aic-ws-title::before { content: counter(aic-ws) '.'; margin-right: 0.35rem; }
.aic-ws-actions { margin-left: auto; display: inline-flex; gap: 0.25rem; }
.aic-ws-actions .btn { padding: 0.15rem 0.5rem; line-height: 1.2; }
.aic-ws-remove:hover { color: #ea4335; border-color: #ea4335; }
.aic-ws-card textarea { font-family: var(--font-mono); font-size: 0.85em; }
.aic-ws-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.aic-ws-steps { font-size: 0.9em; margin: 0 0 0.6rem; padding-left: 1.25rem; }
.aic-ws-steps li { margin-bottom: 0.4rem; }
.aic-ws-steps .url { display: block; padding: 0.05rem 0; word-break: break-all; color: var(--color-muted); }

/* Internetlinks: je Zeile ein Knopf mit dem Satz, der ihn erklärt. */
.aic-link-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.aic-link-actions form { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0; }
.aic-link-actions form .btn { min-width: 9.5rem; }
.aic-link-actions .muted { font-size: 0.85em; }

/* Assistenten-Detail: Beispiele, Link-Auswahl, Vorschläge */
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 700px) { .example-grid { grid-template-columns: 1fr; } }
.example-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.85em; color: var(--color-muted); margin-bottom: 0.5rem; }
.example-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; justify-content: flex-end; }
.ftx-link-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.ftx-chip { background: #eef0f2; padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.85em; display: inline-flex; align-items: center; gap: 0.4rem; max-width: 360px; }
.ftx-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftx-chip-remove { background: none; border: none; color: #c4314b; cursor: pointer; padding: 0; line-height: 1; font-size: 1.1em; }
.ftx-picker { position: relative; margin-top: 0.4rem; }
.ftx-picker-results { position: absolute; z-index: 100; left: 0; right: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); max-height: 260px; overflow: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.ftx-picker-results .item { padding: 0.5rem 0.75rem; cursor: pointer; border-bottom: 1px solid var(--color-border-muted); font-size: 0.9em; }
.ftx-picker-results .item:hover { background: #f2f5f9; }
.ftx-picker-results .item .url { color: var(--color-muted); font-size: 0.85em; word-break: break-all; }
.ftx-drag-handle { cursor: grab; user-select: none; color: #aaa; padding: 0 0.4rem; margin-right: 0.4rem; letter-spacing: -2px; font-family: var(--font-mono); }
[data-aic-ftx-sortable-item].ftx-dragging { opacity: 0.4; }
[data-aic-ftx-sortable-item].ftx-drop-above { box-shadow: 0 -3px 0 0 var(--color-accent) inset, 0 0 0 1px var(--color-accent); }
[data-aic-ftx-sortable-item].ftx-drop-below { box-shadow: 0 3px 0 0 var(--color-accent) inset, 0 0 0 1px var(--color-accent); }
.ftx-saving-hint { position: fixed; bottom: 1rem; right: 1rem; z-index: 1000; background: #333; color: #fff; padding: 0.5rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.85em; opacity: 0; transition: opacity .2s ease; }
.ftx-saving-hint.visible { opacity: 1; }
.ftx-saving-hint.error { background: #c4314b; }
.suggest-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 1.5rem; align-items: start; }
@media (max-width: 700px) { .suggest-grid { grid-template-columns: 1fr; } }
.suggest-range-marks { display: flex; justify-content: space-between; color: #aaa; font-size: 0.75em; margin-top: 0.2rem; }
.suggest-status { font-size: 0.9em; }
.suggest-status.spinning::before { content: ''; display: inline-block; width: 12px; height: 12px; border: 2px solid #ddd; border-top-color: var(--color-accent); border-radius: 50%; animation: aic-spin 0.8s linear infinite; vertical-align: middle; margin-right: 0.4rem; }
.suggestion-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 0.75rem; position: relative; }
.suggestion-card .suggestion-badge { position: absolute; top: -10px; left: 12px; background: var(--color-accent); color: #fff; padding: 0.15rem 0.55rem; border-radius: var(--radius-sm); font-size: 0.7em; font-weight: 600; }
.suggestion-card .source-urls { margin-top: 0.5rem; font-size: 0.85em; color: #666; }
.suggestion-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.suggestion-card.applied { background: #eaf6ee; border-color: #a3d4b3; }
.suggestion-card.applied .suggestion-badge { background: #1f7a44; }

/* ============================================================================
   Verbrauchsseite
   ========================================================================== */
.usage-day-icon { flex: 0 0 auto; line-height: 1; }
.usage-day-meta { font-weight: 400; font-size: 0.88em; color: #666; margin-left: 0.25rem; }
.usage-day-cost { margin-left: auto; background: #e9e9e9; color: #333; padding: 0.15rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.82em; font-weight: 600; white-space: nowrap; }

/* ============================================================================
   Modale Fenster + Hinweis-Einblendung
   ========================================================================== */
.aic-modal { position: fixed; inset: 0; z-index: 9999; }
.aic-modal[hidden] { display: none; }
.aic-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.aic-modal-window {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(90vw, 1100px); max-height: 85vh; display: flex; flex-direction: column;
    background: var(--color-surface); border-radius: 8px; box-shadow: var(--shadow-modal);
    overflow: hidden;
}
.aic-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); }
.aic-modal-header h3 { margin: 0; font-size: 1.1rem; }
.aic-modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 0.4rem; color: #555; }
.aic-modal-close:hover { color: #000; }
.aic-modal-body { padding: 1rem 1.5rem; overflow: auto; }
.aic-modal-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.aic-modal-table thead th { text-align: left; background: var(--color-surface-alt); padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); font-size: 0.9em; color: #555; }
.aic-modal-table tbody td { padding: 0.5rem 0.75rem; vertical-align: top; border-bottom: 1px solid var(--color-border-muted); }
.aic-modal-table .url-cell { word-break: break-all; max-width: 380px; }
.aic-modal-table .msg-cell { color: #c4314b; font-family: var(--font-mono); font-size: 0.85em; }
body.aic-modal-open { overflow: hidden; }

.aic-batch-toast {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
    background: #333; color: #fff; padding: 0.6rem 1rem; border-radius: var(--radius-lg);
    font-size: 0.9em; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
    box-shadow: var(--shadow-modal); min-width: 220px; text-align: center;
}
.aic-batch-toast.visible { opacity: 1; }
.aic-batch-toast[data-kind="success"] { background: #1f7a44; }
.aic-batch-toast[data-kind="warning"] { background: #b78103; }

/* ============================================================================
   Test-Chat und Test-Suche
   ========================================================================== */
.ai-connect-chat { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.ai-connect-chat__messages { display: flex; flex-direction: column; gap: 0.6rem; min-height: 220px; max-height: 60vh; overflow: auto; margin-bottom: 0.75rem; }
.ai-connect-chat__msg { display: flex; }
.ai-connect-chat__msg--assistant { justify-content: flex-start; }
.ai-connect-chat__bubble { background: var(--color-surface-inner); border-radius: var(--radius-lg); padding: 0.5rem 0.85rem; max-width: 80%; }
.ai-connect-chat__msg--assistant .ai-connect-chat__bubble { background: var(--color-surface-head); }
.ai-connect-chat__form { display: flex; gap: 0.5rem; }
.ai-connect-chat__input { flex: 1; }

.ai-connect-search { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.ai-connect-search-form { display: flex; gap: 0.5rem; }
.ai-connect-search-input { flex: 1; }
.ai-connect-search-status { color: var(--color-muted); font-size: 0.9em; }

/* ============================================================================
   Zusammengeführte Bedienpaare: Auswahl + Aktion in EINEM Rahmen
   (Zielsprache + „Übersetzen", „Als Kopie übersetzen", „In Sammlung kopieren")
   ========================================================================== */
.form-select-wrap,
.doc-translate,
.doc-copy {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    vertical-align: middle;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.doc-translate, .doc-copy { margin-inline-start: 0.5rem; }
.form-select-wrap > .form-select,
.doc-translate > .form-select,
.doc-copy > .form-select {
    width: auto;
    border: 0;
    border-radius: 0;
    /* nur die Fläche zurücksetzen — ein Hintergrundbild wäre der Auswahlpfeil */
    background-color: transparent;
    box-shadow: none;
    padding-block: 0.2rem;
}
.form-select-wrap > .btn,
.doc-translate > .btn,
.doc-copy > .btn {
    border: 0;
    border-inline-start: 1px solid var(--color-border);
    border-radius: 0;
    background-color: transparent;
    white-space: nowrap;
}
.form-select-wrap > .btn:hover,
.doc-translate > .btn:hover,
.doc-copy > .btn:hover { background-color: rgba(0, 0, 0, 0.05); }

/* ============================================================================
   Seite „Kopieren“ — Aktionsleiste je Datenquelle + flache Datensatzliste
   ========================================================================== */
.aic-copy-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}
.aic-copy-bar__select,
.aic-copy-bar__run {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.aic-copy-bar__run .form-select { min-width: 14rem; width: auto; }
.aic-copy-need-target { flex-basis: 100%; text-align: right; font-size: 0.9em; }
.aic-copy-need-target[hidden] { display: none; }
.aic-copy-langs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.copy-table tr[hidden] { display: none; }
.copy-table td { vertical-align: middle; }
/* Kürzung kommt aus der .url-cell-Grundregel — kein Buchstabenumbruch mehr. */
.aic-copy-status { margin: 0.9rem 0 0; }
.aic-copy-status.is-ok { color: var(--st-done-fg); }
.aic-copy-status.is-error { color: var(--st-failed-fg); }

/* Agenten-Berichte (Markdown aus dem Lauf): Tabellen, Zitate, aufklappbare Antworten */
.aic-report table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.92em; }
.aic-report th, .aic-report td { text-align: left; vertical-align: top; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--color-border-muted, #e5e5e5); }
.aic-report thead th { font-weight: 600; background: var(--color-surface-inner, #f2f2f2); border-bottom: 2px solid #ddd; }
.aic-report th[align="right"], .aic-report td[align="right"] { text-align: right; white-space: nowrap; }
.aic-report tbody tr:nth-child(even) td { background: var(--color-bg, #f7f7f7); }
.aic-report h2 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
.aic-report h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
.aic-report blockquote { margin: 0.25rem 0 0.75rem; padding: 0.5rem 0.9rem; border-left: 3px solid #cfd8dc; background: var(--color-bg, #f7f7f7); }
.aic-report blockquote > :last-child { margin-bottom: 0; }
details.aic-md-details { border: 1px solid var(--color-border-muted, #e5e5e5); border-radius: 4px; padding: 0.5rem 0.75rem; margin: 0.25rem 0 0.75rem; background: var(--color-bg, #f7f7f7); }
details.aic-md-details > summary { font-weight: 400; color: var(--color-text, #333); }
details.aic-md-details[open] > summary { font-weight: 600; margin-bottom: 0.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--color-border-muted, #e5e5e5); }
.aic-md-details-body > :last-child { margin-bottom: 0; }
.aic-report img { display: inline-block; max-width: 100%; max-height: 160px; width: auto; height: auto; border: 1px solid var(--color-border-muted, #e5e5e5); border-radius: 4px; margin: 0.25rem 0.5rem 0.25rem 0; vertical-align: top; background: #fff; }
.aic-report a > img:hover { box-shadow: 0 0 0 2px #cfd8dc; }

/* ---------------------------------------------------------------- Support-Posteingang
   Warteschlange links, Vorgang rechts. Der Punkt vor jeder Zeile zeigt den
   Zustand des Entwurfs: belegt, teilweise belegt, ohne Fundstelle — und als
   Ring, wenn die Sammlung noch nicht zugeordnet ist. */
.aic-support__bar { display: flex; gap: 1.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .75rem; }
.aic-support__pick { flex: 0 1 320px; }
.aic-support__counts { display: flex; gap: 1.25rem; }
.aic-support__count { font-size: .85rem; color: #6b7785; display: flex; align-items: baseline; gap: .35rem; }
.aic-support__count b { font-size: 1.35rem; color: inherit; font-variant-numeric: tabular-nums; }

.aic-support__tabs { display: flex; gap: .25rem; border-bottom: 1px solid #d7dde3; margin-bottom: .75rem; }
.aic-support__tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: .4rem .8rem; font: inherit; color: #6b7785; cursor: pointer;
}
.aic-support__tab.is-active { color: #0a5ea8; border-bottom-color: #0a5ea8; font-weight: 600; }

.aic-support__split { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 1rem; align-items: start; }
.aic-support__list { border: 1px solid #d7dde3; border-radius: 3px; max-height: 32rem; overflow-y: auto; background: #fff; }
.aic-support__list > p { padding: .9rem; margin: 0; }

.aic-support__row {
    display: grid; grid-template-columns: 10px 1fr auto; gap: .6rem; align-items: start;
    width: 100%; text-align: left; font: inherit; cursor: pointer;
    padding: .6rem .75rem; border: none; border-bottom: 1px solid #eef1f4; background: none;
}
.aic-support__row:hover { background: #f6f8fa; }
.aic-support__row.is-active { background: #e8f1fa; }
.aic-support__pip { width: 9px; height: 9px; border-radius: 50%; margin-top: .35rem; }
.aic-support__pip.is-ok { background: #17724f; }
.aic-support__pip.is-warn { background: #8a5a06; }
.aic-support__pip.is-stop { background: #a32f24; }
.aic-support__pip.is-ask { background: #fff; border: 2px solid #0a5ea8; }
.aic-support__rowmain { min-width: 0; }
.aic-support__title { display: block; font-weight: 600; line-height: 1.3; }
.aic-support__sub { display: block; font-size: .8rem; color: #6b7785; }
.aic-support__coll {
    display: inline-block; font-size: .72rem; font-weight: 600; color: #0a5ea8;
    background: #e8f1fa; border-radius: 2px; padding: 0 .3rem; margin-right: .35rem;
}
.aic-support__coll.is-open { color: #6b7785; background: #eef1f4; }
.aic-support__age { font-size: .75rem; color: #6b7785; white-space: nowrap; font-variant-numeric: tabular-nums; }

.aic-support__detail { border: 1px solid #d7dde3; border-radius: 3px; background: #fff; padding: 1rem; min-height: 20rem; }
.aic-support__dhead { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.aic-support__dhead h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.aic-support__dhead p { margin: 0; font-size: .85rem; }
.aic-support__draftlabel { display: block; margin: .9rem 0 .3rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7785; }
.aic-support__draft { width: 100%; font: inherit; line-height: 1.5; padding: .7rem; border: 1px solid #d7dde3; border-radius: 3px; }
.aic-support__choose { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; }
.aic-support__sources { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.aic-support__source { font-size: .78rem; background: #f6f8fa; border: 1px solid #eef1f4; border-radius: 3px; padding: .1rem .4rem; color: #4a5561; }
.aic-support__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-top: 1rem; }
.aic-support__reassign { margin-left: auto; flex: 0 1 260px; }
.aic-support__keys { margin-top: .6rem; font-size: .78rem; color: #6b7785; }

@media (max-width: 900px) {
    .aic-support__split { grid-template-columns: 1fr; }
    .aic-support__list { max-height: 18rem; }
    .aic-support__keys { display: none; }
}

/* Übernahme in die Supportdatenbank — erscheint unter dem Vorgang, wenn ein
   Mensch die geprüfte Antwort ins Wissen überführen will. */
.aic-support__knowledge { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed #d7dde3; }
.aic-support__knowledge h3 { margin: 0 0 .2rem; font-size: 1rem; }
.aic-support__knowledge .form-control { width: 100%; }
.aic-support__count--wide b { color: #17724f; }

/* Zusammenhang eines Vorgangs: warum ein Mensch gebraucht wird, die Anfrage
   selbst und — eingeklappt — was der Chatbot zuletzt geantwortet hat. */
.aic-support__why { margin: .8rem 0 .3rem; font-size: .85rem; font-weight: 600; color: #8a5a06; }
.aic-support__quote {
    background: #f6f8fa; border-left: 2px solid #d7dde3; padding: .6rem .75rem;
    font-size: .9rem; color: #4a5561; white-space: pre-wrap; max-height: 12rem; overflow-y: auto;
}
.aic-support__botsaid { margin-top: .4rem; font-size: .85rem; }
.aic-support__botsaid summary { cursor: pointer; color: #6b7785; }
.aic-support__new { margin-left: auto; }

/* Gesprächsverlauf im Akkordeon: Besucher links bündig, Chatbot abgesetzt —
   wer was gesagt hat, muss ohne Lesen erkennbar sein. */
.aic-support__history { margin-top: .5rem; font-size: .85rem; }
.aic-support__history summary { cursor: pointer; color: #0a5ea8; }
.aic-support__turns { margin-top: .5rem; display: flex; flex-direction: column; gap: .5rem; max-height: 24rem; overflow-y: auto; }
.aic-support__turn { border-left: 2px solid #d7dde3; padding: .35rem .6rem; }
.aic-support__turn.is-bot { border-left-color: #0a5ea8; background: #f6f9fc; }
.aic-support__turn.is-agent { border-left-color: #8a5a06; background: #fdfaf4; }
.aic-support__turnwho {
    display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: #6b7785; margin-bottom: .15rem;
}
.aic-support__turntext { white-space: pre-wrap; color: #303c48; }

/* Gerenderte Chatbot-Antworten im Verlauf: knappe Abstände, damit Listen den
   Zug nicht auseinanderziehen. */
.aic-support__turntext--rich > *:first-child { margin-top: 0; }
.aic-support__turntext--rich > *:last-child { margin-bottom: 0; }
.aic-support__turntext--rich ul,
.aic-support__turntext--rich ol { margin: .3rem 0 .3rem 1.1rem; padding: 0; }
.aic-support__turntext--rich li { margin: .1rem 0; }
.aic-support__turntext--rich p { margin: .3rem 0; }
.aic-support__turntext--rich code { background: #eef1f4; padding: 0 .2rem; border-radius: 2px; }
.aic-support__turntext--rich table { border-collapse: collapse; font-size: .85em; }
.aic-support__turntext--rich td,
.aic-support__turntext--rich th { border: 1px solid #d7dde3; padding: .15rem .35rem; }

/* Zuweisen: Person wählen und Knopf daneben; Kürzel des Bearbeiters in der Liste. */
/* Das Paar selbst kommt aus .form-select-wrap (Rahmen, Trennlinie, kein Abstand);
   hier nur die Mindestbreite, damit Namen nicht abgeschnitten werden. */
.aic-support__assign > .form-select { min-width: 9rem; }
.aic-support__who {
    display: inline-block; margin-top: .2rem; font-family: ui-monospace, Menlo, monospace;
    font-size: .68rem; font-weight: 700; background: #e8f1fa; color: #0a5ea8;
    border-radius: 2px; padding: 0 .3rem; letter-spacing: .04em;
}

/* Kommentare und Anhänge: die interne Abstimmung des Teams unter dem Vorgang.
   Der Editor ist ein contenteditable mit vier Knöpfen — bewusst klein. */
.aic-support__thread { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid #d7dde3; }
.aic-support__thread h3 { font-size: .95rem; margin: 0 0 .5rem; }
.aic-support__comment { display: grid; grid-template-columns: 28px 1fr; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid #eef1f4; }
.aic-support__avatar {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: #e8f1fa; color: #0a5ea8; font-family: ui-monospace, Menlo, monospace; font-size: .7rem; font-weight: 700;
}
.aic-support__cmeta { font-size: .78rem; color: #6b7785; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.aic-support__cmeta b { color: #303c48; }
.aic-support__cmeta button { background: none; border: 0; padding: 0; color: #0a5ea8; cursor: pointer; font: inherit; font-size: .78rem; }
.aic-support__cbody { font-size: .92rem; line-height: 1.5; color: #303c48; margin-top: .15rem; }
.aic-support__cbody p { margin: .25rem 0; }
.aic-support__cbody ul, .aic-support__cbody ol { margin: .25rem 0 .25rem 1.2rem; padding: 0; }
.aic-support__cbody code { background: #eef1f4; padding: 0 .2rem; border-radius: 2px; }
.aic-support__cbody blockquote { margin: .3rem 0; padding-left: .6rem; border-left: 2px solid #d7dde3; color: #6b7785; }

.aic-support__rte { border: 1px solid #d7dde3; border-radius: 3px; background: #fff; margin-top: .6rem; }
.aic-support__rtebar { display: flex; gap: .15rem; padding: .25rem .35rem; border-bottom: 1px solid #eef1f4; background: #f6f8fa; }
.aic-support__rtebar button {
    font: inherit; font-size: .8rem; min-width: 1.9rem; padding: .15rem .4rem; border: 1px solid transparent;
    background: none; border-radius: 3px; cursor: pointer; color: #303c48;
}
.aic-support__rtebar button:hover { background: #e8ecf0; border-color: #d7dde3; }
.aic-support__rtebar .sep { width: 1px; background: #d7dde3; margin: .2rem .3rem; }
.aic-support__rtebar .spacer { flex: 1; }
.aic-support__rtebody { min-height: 5.5rem; padding: .55rem .7rem; font-size: .92rem; line-height: 1.5; outline: none; }
.aic-support__rtebody:empty::before { content: attr(data-placeholder); color: #8a96a3; }
.aic-support__rtebody:focus { box-shadow: inset 0 0 0 2px rgba(10,94,168,.25); }
.aic-support__rtefoot { display: flex; gap: .5rem; align-items: center; padding: .4rem .5rem; border-top: 1px solid #eef1f4; }
.aic-support__rtefoot .spacer { flex: 1; }

.aic-support__files { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.aic-support__file {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem;
    background: #f6f8fa; border: 1px solid #d7dde3; border-radius: 3px; padding: .2rem .5rem;
}
.aic-support__file a { color: #0a5ea8; text-decoration: none; }
.aic-support__file a:hover { text-decoration: underline; }
.aic-support__file .size { color: #6b7785; }
.aic-support__file button { background: none; border: 0; color: #a32f24; cursor: pointer; font: inherit; font-size: .8rem; padding: 0; }

/* ---- Eingang: eigener Kanal (E-Mail, Formular) ---- */
.aic-support__pip.is-wait { background: #fff; border: 2px solid #8a5a06; }
.aic-support__badge {
    display: inline-block; font-size: .7rem; font-weight: 600; line-height: 1.4;
    padding: 0 .4rem; border-radius: 3px; background: #fdecd6; color: #8a4a00; vertical-align: middle;
}
.aic-support__requester { margin: .1rem 0 0; font-size: .85rem; color: #4a5560; }
.aic-support__requester a { color: #0a5ea8; }
.aic-support__attachpick { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; margin: .35rem 0 .5rem; font-size: .85rem; }
.aic-support__attachpick .form-label { margin: 0; font-weight: 600; }
.aic-support__attachpick label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.aic-support__turn.is-problem { border-left-color: #a32f24; background: #fdf4f3; }
.aic-support__quoted { margin-top: .3rem; font-size: .8rem; }
.aic-support__quoted summary { cursor: pointer; color: #6b7785; }
.aic-support__quoted .aic-support__turntext { color: #6b7785; margin-top: .25rem; }

/* ---- Eingang: Einstellungen ---- */
.aic-sups__section { background: #fff; border: 1px solid #d7dde3; border-radius: 6px; padding: 1rem 1.25rem 1rem; margin: 0 0 1rem; max-width: 62rem; }
.aic-sups__section h2 { font-size: 1.1rem; margin: 0 0 .25rem; }
.aic-sups__section h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.aic-sups__check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-weight: 500; }
.aic-sups__targets { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; margin: .25rem 0; }
.aic-sups__foot { display: flex; align-items: center; gap: .75rem; margin-top: .75rem; }
/* Merkmalsliste im Abschnitt „Ticketsystem" der Eingangs-Einstellungen: nur zum
   Nachlesen, gepflegt wird die Verbindung bei der Sammlung. */
.aic-sups__facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .5rem 0 .75rem; }
.aic-sups__facts dt { color: #6b7280; font-size: .85rem; }
.aic-sups__facts dd { margin: 0; overflow-wrap: anywhere; }
.aic-sups__note { font-size: .85rem; }
.aic-sups__note.is-ok, .aic-sups__testresult.is-ok { color: #17724f; }
.aic-sups__note.is-err, .aic-sups__testresult.is-err { color: #a32f24; }
.aic-sups__testresult { font-size: .85rem; }
.aic-sups__rtebody { min-height: 5.5rem; }

/* ---- Eingang: Schritt 2 (Suche, Wiedervorlage, Kundenkarte, Textbausteine) ---- */
.aic-support__search { max-width: 16rem; }
.aic-support__pip.is-stale { background: #a32f24; box-shadow: 0 0 0 3px #f7d9d6; }
.aic-support__badge.is-due { background: #f7d9d6; color: #7a1f16; }
.aic-support__badge.is-stale { background: #f7d9d6; color: #7a1f16; }
.aic-support__badge.is-soft { background: #eef1f4; color: #4a5560; font-weight: 500; }
.aic-support__due { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; font-size: .85rem; }
.aic-support__due label { font-weight: 600; margin: 0; }
.aic-support__due input[type="date"] { max-width: 11rem; }
.aic-support__customer { margin: .25rem 0 .5rem; font-size: .85rem; }
.aic-support__customer summary { cursor: pointer; color: #0a5ea8; }
.aic-support__customer ul { margin: .35rem 0 0 1.1rem; padding: 0; }
.aic-support__customer li { margin: .15rem 0; }
.aic-support__snippets { max-width: 22rem; margin: 0 0 .35rem; font-size: .85rem; }
.aic-support__create { max-width: 46rem; }
.aic-sups__sniptable td { vertical-align: top; }
.aic-sups__snipbody { white-space: pre-wrap; font-size: .85rem; max-height: 5.5rem; overflow: hidden; }
.aic-sups__snipactions { white-space: nowrap; text-align: right; }
.aic-sups__snipform { border-top: 1px dashed #d7dde3; padding-top: .75rem; margin-top: .5rem; }

/* ---- Eingang: Schritt 3 (KI-Kante) ---- */
.aic-support__badge.is-urgent { background: #a32f24; color: #fff; }
.aic-support__badge.is-angry { background: #fdecd6; color: #8a4a00; }
.aic-support__summary { background: #f6f9fc; border-left: 3px solid #0a5ea8; padding: .5rem .75rem; margin: .5rem 0; font-size: .9rem; }
.aic-support__summary p { margin: 0 0 .3rem; }
.aic-support__summary .muted { font-size: .8rem; margin-right: .5rem; }
.aic-support__prio { display: flex; align-items: center; gap: .5rem; margin: .35rem 0 .5rem; font-size: .85rem; }
.aic-support__prio label { font-weight: 600; margin: 0; }
.aic-support__prio .form-select { max-width: 10rem; }
.aic-support__translate { margin: .25rem 0 .5rem; font-size: .85rem; }
.aic-support__translation { margin-top: .35rem; padding: .35rem .6rem; background: #fff; border: 1px dashed #d7dde3; border-radius: 4px; white-space: pre-wrap; color: #303c48; }
.aic-support__similar { margin: .5rem 0; font-size: .85rem; }
.aic-support__similar summary { cursor: pointer; color: #0a5ea8; }
.aic-support__simhit { border-left: 2px solid #d7dde3; padding: .35rem .6rem; margin: .4rem 0; }
.aic-support__simhead a { font-weight: 600; }
.aic-support__simanswer { white-space: pre-wrap; color: #303c48; margin: .25rem 0; max-height: 9rem; overflow: auto; }

/* ---- Eingang: Schritt 4 (Regeln) ---- */
.aic-sups__rule { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; flex-wrap: wrap; }
.aic-sups__rule .form-select { max-width: 14rem; }


/* ── Baukasten für den Einbettungs-Code ────────────────────────────────
   Felder oben, fertiger Schnipsel darunter. Der Code-Block ist dunkel,
   damit er sich klar vom Formular absetzt und als Ergebnis lesbar ist. */
/* Chat-Seite: schmal wie bisher; ab 1400px zwei Spalten — Test-Chat links (max. 760px),
   Einbettungs-Code rechts. Kopf und Einleitung bleiben oben in Lesebreite. */
.aic-main--chat { max-width: 760px; }
.aic-chat-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.aic-chat-layout__chat, .aic-chat-layout__embed { min-width: 0; }
/* Statuszeile über dem Test-Chat: was gerade läuft (Sprache, Assistent, Modell) + „ändern" */
.aic-chat-status { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 .75rem; font-size: .85rem; color: var(--color-text-muted, #666); }
.aic-chat-status__label { margin-right: .15rem; }
.aic-chat-status__tag { display: inline-block; padding: .15rem .6rem; border: 1px solid var(--color-border, #d8dcdc); border-radius: 999px; background: var(--color-surface, #fff); color: var(--color-text, #222); white-space: nowrap; }
.aic-chat-status__edit { margin-left: .25rem; padding: 0 .55rem; height: 1.55rem; line-height: 1.55rem; font-size: .75rem; }
.aic-chat-layout__embed { margin-top: .5rem; }
.aic-chat-layout__title { margin: 0 0 .5rem; font-size: 1.2rem; font-weight: 600; }
/* Ab 1300px zwei gleich breite Spalten (der Chat kommt mit ~560px gut aus, der
   Baukasten braucht sie für zwei Feldspalten); ab 1750px bekommt der Chat seine
   vollen 760px und der Baukasten den Rest. */
@media (min-width: 1300px) {
    .aic-main--chat { max-width: none; }
    .aic-main--chat > .lead { max-width: 760px; }
    .aic-chat-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
    .aic-chat-layout__embed { margin-top: 0; }
}
@media (min-width: 1750px) {
    .aic-chat-layout { grid-template-columns: minmax(0, 760px) minmax(0, 1fr); }
}
.aic-embed-cfg__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem 1rem;
    margin-bottom: 1rem;
}
.aic-embed-cfg__field {
    position: relative;   /* Anker für die Sprach-Pills */
    display: grid;
    gap: .25rem;
    font-size: .85rem;
}
.aic-embed-cfg__field > span,
.aic-embed-cfg__label-row label,
.aic-embed-cfg__label-row > span {
    font-weight: 600;
    color: var(--color-text-muted, #666);
}
/* Zeile 1: Sprachwahl (auch leer, damit alle Felder gleich hoch beginnen); Zeile 2: Beschriftung + Hilfe */
.aic-embed-cfg__langs-row { min-height: 1.5rem; display: flex; justify-content: flex-end; align-items: flex-end; }
.aic-embed-cfg__label-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 1.4rem; }
.aic-embed-cfg__help {
    flex: 0 0 auto; width: 1.2rem; height: 1.2rem; padding: 0; border-radius: 50%;
    border: 1px solid var(--color-text-muted, #888); background: transparent; color: var(--color-text-muted, #666);
    font: inherit; font-size: .72rem; font-weight: 700; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.aic-embed-cfg__help:hover, .aic-embed-cfg__help:focus-visible { color: var(--color-button, #222); border-color: var(--color-button, #222); }
/* Häkchen im Raster: Beschriftung links, ?-Knopf rechts; im Funktionen-Kasten bleibt alles linksbündig */
.aic-embed-cfg__grid > .aic-embed-cfg__check { justify-content: space-between; }
.aic-embed-cfg__features .aic-embed-cfg__check { justify-content: flex-start; align-self: auto; padding-bottom: 0; }
.aic-embed-cfg__check > label { display: flex; align-items: center; gap: .45rem; cursor: pointer; }
.aic-embed-cfg__features summary .aic-embed-cfg__label-row { width: auto; }
.aic-embed-cfg__check.is-inactive > label > span { color: var(--color-text-muted, #888); }
.aic-embed-cfg__check--plain { cursor: default; }
.aic-embed-cfg__check.is-inactive input[disabled] { opacity: .45; cursor: not-allowed; }
.aic-embed-cfg__features .aic-embed-cfg__check { justify-content: space-between; gap: .5rem; }
.aic-embed-cfg__setup { flex: 0 0 auto; padding: 0 .3rem; height: 1.4rem; line-height: 1.4rem; font-size: .7rem; }
.aic-embed-cfg__setup[hidden] { display: none; }
/* Grund statt „einstellen" (Souveränität mit unpassendem Sprachmodell): eigene Zeile
   unter dem Häkchen, eingerückt auf die Beschriftung — nie neben dem Label, sonst
   quetscht der Text die Beschriftung auf Buchstabenbreite. */
.aic-embed-cfg__features .aic-embed-cfg__check { flex-wrap: wrap; }
.aic-embed-cfg__features .aic-embed-cfg__check > label { flex: 0 1 auto; white-space: nowrap; }
.aic-embed-cfg__note { flex: 1 1 100%; font-size: .7rem; line-height: 1.3; color: var(--color-text-muted, #888); padding-left: 1.65rem; }
.aic-embed-cfg__note[hidden] { display: none; }
/* Hinweis unter dem Test-Chat (Darstellung/Panel-Breite nicht in der Vorschau): auffällig, fadet nach 10 s aus */
.aic-embed-cfg__notice {
    margin: .85rem 0 0; padding: .75rem 1rem .75rem 2.6rem; position: relative;
    border: 1px solid #f0c36d; border-radius: 8px; background: #fff4d6; color: #5c4300;
    font-size: .9rem; line-height: 1.45; opacity: 1; transition: opacity .8s ease;
}
.aic-embed-cfg__notice::before { content: "ⓘ"; position: absolute; left: .9rem; top: .6rem; font-size: 1.15rem; line-height: 1.2; }
.aic-embed-cfg__notice.is-fading { opacity: 0; }
.aic-embed-cfg__notice[hidden] { display: none; }
.aic-embed-cfg__reset { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-top: .25rem; }
.aic-embed-cfg__reset .form-text { margin: 0; }
.aic-embed-cfg__check--inline { font-size: .85rem; }
.aic-embed-cfg__inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--color-text-muted, #666); }
.aic-embed-cfg__inline[hidden] { display: none; }
.aic-embed-cfg__field input,
.aic-embed-cfg__field textarea,
.aic-embed-cfg__field select {
    padding: .4rem .5rem;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}
.aic-embed-cfg__check {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    align-self: end;
    padding-bottom: .45rem;
}
.aic-embed-cfg__out {
    position: relative;
}
.aic-embed-cfg__out pre {
    margin: 0;
    padding: 1rem;
    background: #1e2529;
    border-radius: 8px;
    overflow-x: auto;
}
.aic-embed-cfg__out code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    line-height: 1.6;
    color: #d8e0e0;
    white-space: pre;
}
.aic-embed-cfg__copy {
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: .3rem .7rem;
    font-size: .75rem;
    font-weight: 600;
    color: #d8e0e0;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 5px;
    cursor: pointer;
}
.aic-embed-cfg__copy:hover { background: rgba(255, 255, 255, .18); }
.aic-embed-cfg__copy.is-copied { border-color: #ff5c1c; color: #ff8b5c; }
.aic-embed-cfg__copy:focus-visible { outline: 2px solid #ff5c1c; outline-offset: 1px; }


/* ── Erlaubte Websites für das Widget ─────────────────────────────────── */
.aic-origins {
    margin: 1rem 0 1.5rem;
    padding: 1rem 1.1rem;
    background: var(--color-surface-alt, #f6f4f9);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 8px;
}
.aic-origins__title {
    margin: 0 0 .35rem;
    font-size: .95rem;
    font-weight: 600;
}
.aic-origins__row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .4rem;
    max-width: 520px;
}
.aic-origins__row input {
    flex: 1 1 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85rem;
}
.aic-origins__del {
    flex: 0 0 auto;
    width: 1.9rem;
    height: 1.9rem;
    line-height: 1;
    font-size: 1.1rem;
    color: var(--color-text-muted, #777);
    background: transparent;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 5px;
    cursor: pointer;
}
.aic-origins__del:hover { color: #c0392b; border-color: #c0392b; }
.aic-origins__del:focus-visible { outline: 2px solid #ff5c1c; outline-offset: 1px; }
.aic-origins__actions {
    display: flex;
    gap: .5rem;
    margin-top: .6rem;
}

/* display:grid auf .aic-embed-cfg__field schlug das hidden-Attribut — das
   Zielelement-Feld war deshalb immer sichtbar, wirkte aber nur bei fester
   Einbettung. Jetzt gewinnt hidden. */
.aic-embed-cfg__field[hidden] { display: none; }
.aic-embed-cfg__field--wide { grid-column: 1 / -1; }
/* Abschnitte des Baukastens — gleiche Optik wie der Funktionen-Kasten */
.aic-embed-cfg__section { border: 1px solid var(--color-border, #d8dde3); border-radius: 8px; padding: .5rem .9rem .8rem; margin: 0 0 .9rem; min-width: 0; }
/* Abschnitte sind Akkordeons: die Titelzeile liegt wie eine Legende auf der Rahmenlinie,
   rechts vom Titel ein Pfeil (▸ zu / ▾ offen), Zeiger und Hover machen die Klickbarkeit klar. */
.aic-embed-cfg__section > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: .45rem;
    width: auto;   /* volle Breite: die ganze Titelzeile schaltet um */
    margin: 0 0 .45rem 0; padding: .1rem 0;
    font-size: .85rem; font-weight: 600; color: var(--color-text-muted, #666);
    border-radius: 4px;
}
.aic-embed-cfg__section > summary::-webkit-details-marker { display: none; }
.aic-embed-cfg__section > summary::after {
    content: ''; flex: 0 0 auto; width: .42rem; height: .42rem; margin-left: auto; margin-right: .3rem;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-.1rem) rotate(-45deg); transition: transform .15s ease;
}
.aic-embed-cfg__section[open] > summary::after { transform: translateY(-.2rem) rotate(45deg); }
.aic-embed-cfg__section > summary:hover, .aic-embed-cfg__section > summary:focus-visible { color: var(--color-button, #222); }
.aic-embed-cfg__section:not([open]) { padding-bottom: .5rem; }
.aic-embed-cfg__section:not([open]) > summary { margin-bottom: 0; }
.aic-embed-cfg__section > summary .aic-embed-cfg__label-row { gap: .45rem; }
.aic-embed-cfg__section > .aic-embed-cfg__grid { margin-bottom: 0; }
.aic-embed-cfg__section[hidden] { display: none; }
/* Funktionen-Kasten: drei gleich hohe Spalten, dezente Linien zwischen den Zeilen,
   Streaming zuletzt über die volle Breite. Kein Spaltenabstand — die Linien laufen
   durch; der Abstand steckt als Innenabstand in den Zellen. */
.aic-embed-cfg__features-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.aic-embed-cfg__features .aic-embed-cfg__check {
    min-height: 2.75rem; margin: 0; padding: .3rem .45rem .3rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border, #d8dde3) 55%, transparent);
}
.aic-embed-cfg__features .aic-embed-cfg__check--wide { grid-column: 1 / -1; border-bottom: 0; justify-content: flex-start; gap: .45rem; }
.aic-embed-cfg__features .aic-embed-cfg__check > label { min-width: 0; }
.aic-embed-cfg__features .aic-embed-cfg__check > label > span { line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.aic-embed-cfg__features .aic-embed-cfg__check > label { flex: 1 1 auto; gap: .4rem; }
@media (max-width: 640px) { .aic-embed-cfg__features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Akkordeon „CSS-Vorlage“: als Leiste erkennbar, Pfeil aus .aic-accordion, Hinweis rechts */
.aic-embed-cfg__css { margin-top: .9rem; border: 1px solid var(--color-border, #d8dde3); border-radius: 8px; background: #fff; }
.aic-embed-cfg__section > .aic-embed-cfg__css { margin-top: .75rem; }
.aic-embed-cfg__css[hidden] { display: none; }
.aic-embed-cfg__css > summary { padding: .7rem 1rem; font-size: .95rem; background: #f3f5f7; border-radius: 8px; }
.aic-embed-cfg__css[open] > summary { border-bottom: 1px solid var(--color-border, #d8dde3); border-radius: 8px 8px 0 0; }
.aic-embed-cfg__css > summary:hover { background: #e9edf1; text-decoration: none; }
.aic-embed-cfg__css-hint { margin-left: auto; font-weight: 400; font-size: .82rem; color: var(--color-text-muted, #666); }
.aic-embed-cfg__css > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.aic-embed-cfg__css > p.form-text { margin-top: .7rem; }
.aic-embed-cfg__css > [data-aic-css-pane] { margin-bottom: 1rem; }
.aic-embed-cfg__css .aic-embed-cfg__out pre { max-height: 24rem; }
.aic-embed-cfg__tabs { display: flex; gap: .25rem; margin: .5rem 0; }
.aic-embed-cfg__tabs .btn.active { background-color: var(--color-button); border-color: var(--color-button); color: var(--color-button-text); }
[data-aic-css-pane][hidden] { display: none; }
/* Sprach-Pills je Textfeld (Titel, Name, Begrüßung) — wie im Bearbeiten-Formular */
.aic-embed-cfg__langs { display: flex; gap: .25rem; font-weight: 400; }
.aic-embed-cfg__langs .btn { padding: 0 .5rem; height: 1.5rem; font-size: .72rem; line-height: 1.4; }
.aic-embed-cfg__langs .btn.active { background-color: var(--color-button); border-color: var(--color-button); color: var(--color-button-text); }
.aic-embed-cfg__field--row { grid-column: 1; }   /* beginnt eine neue Reihe */
.aic-embed-cfg__field textarea { resize: vertical; font: inherit; }

/* Akzentfarbe: Textfeld und Farbwähler nebeneinander, gleich hoch */
.aic-embed-cfg__color {
    display: flex;
    gap: .4rem;
    align-items: stretch;
}
.aic-embed-cfg__color input[type="text"] { flex: 1 1 auto; font-family: ui-monospace, Menlo, monospace; }
.aic-embed-cfg__color input[type="color"] {
    flex: 0 0 2.6rem;
    width: 2.6rem;
    padding: .15rem;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}
.aic-embed-cfg__field input.is-invalid { border-color: #c0392b; background: #fdf2f1; }

/* Speichern ohne Neuladen: Rückmeldung neben den Knöpfen */
.aic-origins__status { font-size: .85rem; align-self: center; }
.aic-origins__status.is-ok { color: #0f7a5a; }
.aic-origins__status.is-error { color: #c0392b; }
.aic-embed-cfg__status { font-weight: 600; }
.aic-origins-status { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.aic-origins-status__btn { flex: 0 0 auto; }
.aic-embed-cfg__status.is-ok { color: #0f7a5a; }
.aic-embed-cfg__status.is-error { color: #c0392b; }
.aic-support__why.is-warn { color: #7a1f16; }

/* ------------------------------------------------------------------ Kundeninstanzen (Betreiber) + Fernwartung */
.inst-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1.25rem; }
.inst-h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.inst-kv { margin: 0 0 .75rem; }
.inst-warn { color: #9a5b00; }
.inst-radio, .inst-check { display: block; margin: .2rem 0; }
.inst-inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inst-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0 .6rem; }
.inst-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.inst-actions form { margin: 0; }
.inst-dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.inst-dl dt { color: var(--color-muted); }
.inst-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.inst-jobs { display: grid; gap: .5rem; }
.inst-job { border: 1px solid var(--color-border, #ddd); border-radius: 6px; padding: .45rem .7rem; background: var(--color-surface, #fff); }
.inst-job summary { cursor: pointer; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inst-log { font-family: var(--font-mono); font-size: .8em; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto; margin: .5rem 0 0; padding: .6rem .75rem; background: var(--color-surface-div, #f5f5f5); border-radius: 4px; }
.inst-status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8em; background: #e9ecef; color: #333; }
.inst-status--running { background: #fff3cd; color: #664d03; }
.inst-status--done { background: #d1e7dd; color: #0f5132; }
.inst-status--failed { background: #f8d7da; color: #842029; }
.oa-state { margin: .25rem 0 .75rem; }
.oa-state--on { color: #0f5132; }
.operator-banner { background: #cfe2ff; color: #084298; border-color: #b6d4fe; }
.limit-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.limit-banner__close { background: none; border: 1px solid currentColor; border-radius: 4px; color: inherit; padding: .15rem .5rem; font-size: .85em; cursor: pointer; white-space: nowrap; }
.inst-limits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.25rem; }
.inst-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .25rem .75rem; margin-top: .35rem; }
.inst-state-ok { background: #e6f4ea; color: #137333; }
.inst-state-warn { background: #fef7e0; color: #b06000; }
.inst-state-blocked { background: #fce8e6; color: #c5221f; }
.inst-danger { border-color: #e3b6b6; margin-top: 1rem; }
.inst-danger .inst-h2 { color: #842029; }
