/* ===== Skip-Link (Barrierefreiheit WCAG 2.4.1) ===== */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    position: fixed;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    z-index: 9999;
    width: auto;
    height: auto;
    padding: 10px 20px;
    background: #fff;
    color: #1a1a1a;
    border: 2px solid var(--mud-palette-primary, #594ae2);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== Nur-fuer-Screenreader (visuell versteckt, fuer AT lesbar) ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Base & Typography ===== */

pre {
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
}

div.mud-tabs-panels > div > pre {
    padding-top: initial;
    padding-bottom: initial;
}

blockquote:empty {
    display: none;
    pointer-events: none;
}

blockquote:not(:empty) {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--mud-palette-primary);
    background: var(--mud-palette-background);
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}

blockquote:not(:empty) p::before {
    content: none;
}

ul, ol {
    padding: 0 1.5rem;
    margin: 0.5rem 0;
}

ul > li, ol > li {
    padding-left: 0.4rem;
    padding-bottom: 0.25rem;
}

/* ===== Blazor Framework ===== */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=)
            no-repeat 1rem/1.8rem,
        #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #004072;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ===== Code Highlighting ===== */

.hljs-copy-button {
    top: 2em !important;
}

.hljs-copy-button:hover {
    filter: brightness(150%);
}

.hljs-copy-button[data-copied="true"] {
    padding: 1em;
    background-color: #1b5e20;
}

.hljs-copy-button[data-copied="true"]:hover {
    filter: none;
    background-color: initial;
}

/* ===== MudBlazor Overrides ===== */

.mud-snackbar.mud-snackbar-blurred {
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.mud-input-control.mud-input-number-control input[type="number"] {
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
    appearance: textfield;
}

button {
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

.mud-tooltip-root {
    width: -moz-fit-content;
    width: -webkit-fit-content;
    width: fit-content;
}

.full-width {
    width: 100% !important;
}

/* ===== CSS Variables ===== */
:root {
    --kibot-user-bubble-bg: #dbeeff;
    --kibot-widget-width: 390px;
    --kibot-widget-height: 570px;
}

/* ===== Base ===== */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: transparent;
    font-family: 'Lato', 'Inter', system-ui, sans-serif;
}

/* Admin-Seiten: eigener Scrollbereich, weil html/body oben bewusst overflow:hidden
   haben (Chat scrollt intern). Ohne diesen Container sind lange Admin-Seiten
   (Dashboard, RAG, Audit) nicht scrollbar. */
.admin-scroll {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Admin-Register mit breiten Tabellen (Audit 9 Spalten, RAG-Dokumente 11 Spalten):
   Der Seitencontainer bleibt responsive, die Tabelle selbst bekommt einen eigenen
   horizontalen Scrollbalken. Ohne das schneidet .admin-scroll (overflow-x:hidden)
   die rechten Spalten samt Aktionsknoepfen ab. */
.admin-scroll .mud-table-container {
    overflow-x: auto;
    max-width: 100%;
}

/* Register-Inhalte duerfen im Flex-Layout schrumpfen, sonst schiebt eine breite
   Tabelle die ganze Registerleiste aus dem Bild. */
.admin-scroll .mud-tabs-panels,
.admin-scroll .mud-tabs-tabpanel {
    min-width: 0;
}

/* ===== Embedded Mode — füllt den iframe ===== */
.chat-embedded-wrapper {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

.chat-root.chat-root--embedded {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0;
    box-shadow: none;
}

/* iframe-Modus: runde Ecken, Header sichtbar mit Titelzeile */
.chat-root.chat-root--iframe {
    border-radius: 16px;
}

/* ===== Widget Container — fixed bottom right ===== */
.widget-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

/* ===== Chat Panel ===== */
.chat-root {
    width: var(--kibot-widget-width);
    height: var(--kibot-widget-height);
    max-height: calc(100vh - 6rem);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0s;
}

.widget-closed .chat-root {
    opacity: 0;
    transform: scale(0.85) translateY(12px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.widget-open .chat-root {
    opacity: 1;
    transform: none;
    pointer-events: all;
    visibility: visible;
}

/* ===== Header ===== */
.chat-header {
    flex-shrink: 0;
    background: var(--mud-palette-primary);
    border-radius: 16px 16px 0 0;
}

.chat-header-inner {
    padding: 0.625rem 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
    font-family: 'Lato', sans-serif;
}

/* ===== Messages ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: #ffffff;
}

/* Lesbare Zeilenlaenge: auf breiten Monitoren lief der Text ueber die volle
   Bildschirmbreite (Rueckmeldung A. Blomeyer 2026-09-01). Der Scrollbereich bleibt
   voll breit, nur der Inhalt wird zentriert begrenzt. */
.chat-messages > *,
.chat-input-container {
    max-width: 1100px;
    margin-inline: auto;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default);
    border-radius: 2px;
}

/* ===== Welcome Screen ===== */
/* ===== Thread ===== */
.chat-thread {
    padding: 1rem 0.875rem 1.5rem;
}

/* ===== Messages ===== */
.chat-msg {
    margin-bottom: 1.25rem;
    animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg--user {
    display: flex;
    justify-content: flex-end;
}

.chat-msg--user .chat-msg-content {
    max-width: 80%;
}

.chat-msg-bubble--user {
    background: var(--kibot-user-bubble-bg);
    color: var(--mud-palette-text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.9375rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Kontaktanfrage an die Kasse: Karte statt Sprechblase (Thema + Nachricht). */
.chat-msg-bubble--contact {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-primary);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}
.chat-contact-card-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
    margin-bottom: 0.375rem;
}
.chat-contact-card-row {
    display: flex;
    gap: 0.5rem;
    line-height: 1.5;
}
.chat-contact-card-label {
    flex: 0 0 auto;
    min-width: 5.5rem;
    color: var(--mud-palette-text-secondary);
}

.chat-msg--assistant {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
}

.chat-msg-avatar {
    flex-shrink: 0;
    padding-top: 2px;
}

.chat-msg--assistant .chat-msg-content {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 88%;
    background: #ffffff;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px 16px 16px 4px;
    padding: 0.625rem 0.875rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ===== Input Area ===== */
.chat-input-area {
    flex-shrink: 0;
    padding: 0.625rem 0.875rem 0.875rem;
    background: #ffffff;
}

.chat-input-container {
    width: 100%;
}

.chat-input-box {
    display: flex;
    align-items: flex-end;
    gap: 0.375rem;
    padding: 1px 0.5rem 1px 0.875rem;
    border: 1.5px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.2s ease;
    min-height: 48px;
}

.chat-input-box:focus-within {
    border-color: var(--mud-palette-primary);
}

.chat-input-field {
    flex: 1;
}

.chat-input-field .mud-input-slot {
    padding: 0.375rem 0 !important;
    font-size: 0.9375rem;
}

.chat-input-field .mud-input-underline::before,
.chat-input-field .mud-input-underline::after {
    display: none !important;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-bottom: 2px;
}

.chat-send-btn {
    border-radius: 50% !important;
    transition: all 0.15s ease !important;
}

.chat-send-btn--active {
    background: var(--mud-palette-primary) !important;
    color: white !important;
}

/* ===== Input Footer (disclaimer + clear button) ===== */
.chat-input-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

/* Disclaimer-Text leicht kleiner als der uebrige Text (Feedback PK-Messe). */
/* Min. 0.75rem fuer WCAG 1.4.4 (Text bei 200% Zoom lesbar). */
.chat-input-footer .mud-typography-caption {
    font-size: 0.75rem;
}

/* ===== Kontakt zur Kasse / Berater-Notausstieg (#642332) ===== */
/* Dauerhaft sichtbar (FRN 2026-08-31): der Weg zum Menschen ist kein Zusatzangebot, das
   je nach Gespraechsstand erscheint oder verschwindet. Er sitzt in der fixierten
   Eingabe-Fusszeile, bleibt also beim Scrollen stehen, und wird nicht mehr per Opazitaet
   zurueckgenommen — nur die Schriftgroesse bleibt zurueckhaltend. */
.chat-contact-btn {
    /* Eigenständiger, sichtbarer Knopf in der Eingabe-Fusszeile (FRN 07.09.2026): Outline in
       Primärfarbe, normale Schriftgrösse, etwas Luft — kein Fussnoten-Link mehr. */
    font-size: 0.875rem !important;
    font-weight: 600;
    opacity: 1;
    text-transform: none;
    border-width: 1.5px !important;
    border-radius: 18px !important;
    padding: 4px 14px !important;
    margin: 4px 8px !important;
    background: var(--mud-palette-surface);
}

.chat-contact-btn:hover {
    opacity: 1;
}

.chat-feedback-contact {
    border-top: 1px solid var(--mud-palette-divider);
    padding-top: 4px;
}

/* Zusammenfassung „Das wird gesendet" — abgesetzt, damit der Inhalt vor dem
   Absenden klar erkennbar ist. */
.chat-contact-summary {
    background: var(--mud-palette-background-grey);
    border-radius: 8px;
    padding: 8px 12px;
}

/* Feste Label-Spalte, damit Thema/Anliegen als Key-Value-Zeilen lesbar sind. */
.chat-contact-summary-label {
    min-width: 5rem;
    flex-shrink: 0;
    line-height: 1.6; /* optisch auf die body2-Werte ausrichten */
}

.chat-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.chat-clear-btn:hover {
    opacity: 1;
}

.chat-clear-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.chat-clear-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* ===== Header Icon Buttons (custom SVG) ===== */
.chat-header-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.chat-header-icon-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

.chat-header-icon-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.chat-header-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
    display: block;
}

/* ===== FAB Button ===== */
.widget-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    outline: none;
    padding: 0;
}

.widget-fab:focus-visible {
    outline: 3px solid var(--mud-palette-primary, #594ae2);
    outline-offset: 3px;
}

.widget-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.widget-fab:active {
    transform: scale(0.96);
}

/* ===== Answer Component ===== */

.answer-content {
    line-height: 1.7;
}

.answer-text {
    overflow-wrap: break-word;
}

.answer-text table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}

.answer-text table th,
.answer-text table td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.answer-text table th {
    background: var(--mud-palette-background);
    font-weight: 600;
}

/* Bilder in Antworten (QR-Code des eID-Flows, Grafiken aus Dokumenten).
   Die Darstellung steht bewusst hier und nicht als style-Attribut im Markup:
   der Parser baut jedes <img> aus einer Attribut-Allowlist neu auf (XSS-Schutz)
   und laesst style dabei fallen. Siehe Answer.razor.Parser.cs → SanitizeImgTag. */
.answer-image {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 16px auto;
    max-width: 300px;
}

/* ===== Datenfluss-Panel (Dev-Mode) ===== */

/* Tab am rechten Rand (eingeklappt) */
.devflow-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background: var(--mud-palette-primary);
    color: white;
    padding: 12px 8px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transition: background 0.15s ease;
    user-select: none;
}
.devflow-tab:hover {
    background: var(--mud-palette-primary-darken);
}

/* Panel (aufgeklappt) */
.devflow-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #f8f9fa;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
    animation: devflowSlideIn 0.25s ease;
}
@keyframes devflowSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Header */
.devflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--mud-palette-primary);
    color: white;
    flex-shrink: 0;
}
.devflow-header-title {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Body */
.devflow-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.devflow-body::-webkit-scrollbar { width: 5px; }
.devflow-body::-webkit-scrollbar-track { background: transparent; }
.devflow-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Guard/Config status bar */
.devflow-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

/* Steps container */
.devflow-steps {
    display: flex;
    flex-direction: column;
}

/* Single step */
.devflow-step {
    display: flex;
    gap: 12px;
    min-height: 48px;
}

/* Connector (dot + line) */
.devflow-step-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
}
.devflow-step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #adb5bd;
    background: white;
    flex-shrink: 0;
    margin-top: 14px;
    transition: all 0.2s ease;
}
.devflow-step-dot--done {
    background: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
}
.devflow-step-dot--active {
    background: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
    animation: devflowPulse 1.5s ease-in-out 2;
}
@keyframes devflowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 64, 114, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(0, 64, 114, 0); }
}
.devflow-step-line {
    width: 2px;
    flex: 1;
    background: #dee2e6;
    min-height: 8px;
}

/* Expansion panel overrides */
.devflow-expansion {
    background: transparent !important;
}
.devflow-expansion .mud-expansion-panels {
    background: transparent !important;
}
.devflow-expansion-panel {
    background: white !important;
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    margin-bottom: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}
.devflow-expansion-panel .mud-expand-panel-header {
    padding: 8px 12px !important;
    min-height: 40px !important;
}
.devflow-expansion-panel .mud-expand-panel-content {
    padding: 0 12px 12px !important;
}

/* Data content inside steps */
.devflow-step-data {
    font-size: 0.8rem;
    color: #495057;
    line-height: 1.5;
}
.devflow-pre {
    background: #f1f3f5;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.7rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    margin: 4px 0;
    color: #212529;
}
.devflow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
    margin: 4px 0;
}
.devflow-table th, .devflow-table td {
    border: 1px solid #dee2e6;
    padding: 3px 6px;
    text-align: left;
}
.devflow-table th { background: #e9ecef; font-weight: 600; }
.devflow-table code { font-size: 0.68rem; color: #d63384; }
.devflow-wait {
    font-size: 0.7rem;
    color: #adb5bd;
    font-style: italic;
    padding: 4px 0;
}
.devflow-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
}

/* Empty state */
.devflow-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

/* Mapping table */
.devflow-step-data .mud-table {
    background: white !important;
}
.devflow-step-data .mud-table th {
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
    background: #f1f3f5 !important;
}
.devflow-step-data .mud-table td {
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
}
.devflow-step-data code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.7rem;
    background: #f1f3f5;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Adjust widget when devflow-panel is open */
.widget-container .chat-root.devflow-open {
    width: calc(var(--kibot-widget-width) + 400px);
}

.answer-citations {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.citation-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.citation-snippet {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
    max-width: 600px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.citation-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Feste Hoehe + border-box, damit Text-Chip und Icon-Chip exakt gleich gross sind
       (sonst macht die groessere Zeilenhoehe des Texts den Chip hoeher als das 16px-Icon). */
    box-sizing: border-box;
    height: 32px;
    line-height: 1;
    padding: 4px 12px;
    border: 1px solid var(--mud-palette-primary);
    border-radius: 6px;
    background: transparent;
    color: var(--mud-palette-primary);
    /* font-family/margin/text-align explizit, damit <button class="citation-chip">
       identisch zum <a> rendert (UA-Button-Defaults zuruecksetzen). */
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: left;
    margin: 0;
    text-decoration: none;
    cursor: pointer;
    max-width: 280px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: background 0.15s ease;
}

.citation-chip:hover {
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    text-decoration: none;
}

.citation-chip svg {
    flex-shrink: 0;
    fill: currentColor;
}

/* Portalseiten-Zitate: der Seitentitel ist die einzige Orientierung, darum breiter als der Dokument-Chip. */
.citation-chip--portal {
    max-width: 560px;
}

.citation-chip--disabled {
    cursor: default;
    opacity: 0.45;
}

.citation-chip--disabled:hover {
    background: transparent;
}

/* Icon-only Variante (z.B. Download-Knopf neben einem Dokument-Chip). */
.citation-chip--icon {
    padding: 4px 8px;
    gap: 0;
}

.answer-followups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.answer-followup-btn {
    text-transform: none !important;
    font-weight: 400 !important;
    border-radius: 20px !important;
    font-size: 0.8125rem !important;
}

/* ===== Answer Error ===== */

.answer-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(211, 47, 47, 0.06);
    border: 1px solid rgba(211, 47, 47, 0.2);
}

/* ===== Loading Indicator ===== */

.loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
}

.loading-indicator-text {
    font-style: normal;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
}

.loading-indicator-dots {
    margin-left: 3px;
}

.loading-indicator-dots span {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    margin-left: 1px;
    animation: dotBlink 1.4s infinite both;
}

.loading-indicator-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-indicator-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBlink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.thinking-indicator .thinking-text {
    font-style: italic;
    animation: fadeInText 0.5s ease-in;
}

@keyframes fadeInText {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Task Panel ===== */

.task-panel {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 340px;
    max-height: 400px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.task-panel.collapsed {
    max-height: 44px;
}

.task-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    background: var(--mud-palette-background);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    user-select: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.task-panel-header:hover {
    background: var(--mud-palette-background-grey);
}

.task-panel-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 0.5rem;
}

.task-item {
    padding: 0.5rem 0.625rem;
    margin-bottom: 0.375rem;
    border-radius: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    animation: msgFadeIn 0.2s ease;
}

.task-item:last-child {
    margin-bottom: 0;
}

.task-item.task-running {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}

.task-item.task-completed {
    border-color: var(--mud-palette-success);
    background: rgba(var(--mud-palette-success-rgb), 0.04);
}

.task-item.task-failed {
    border-color: var(--mud-palette-error);
    background: rgba(var(--mud-palette-error-rgb), 0.04);
}

.task-item-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
}

.task-description {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mud-palette-text-primary);
}

.task-progress {
    margin-top: 0.375rem;
}

.task-result-preview {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-background);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.task-result-preview:hover {
    background: var(--mud-palette-background-grey);
}

.task-result-preview span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-error {
    margin-top: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--mud-palette-error);
    background: rgba(var(--mud-palette-error-rgb), 0.06);
    border-radius: 6px;
}

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

.spin {
    animation: spin 1.2s linear infinite;
}

/* ===== PDF Viewer ===== */

.pdf-container {
    min-height: 60vh;
    max-height: 75vh;
    overflow-y: scroll;
}

iframe {
    min-height: 60vh;
    min-width: 100%;
}

/* ===== PDF Viewer im Vollbild-Dialog ===== */
/* iframe bekommt eine EXPLIZITE Viewport-Höhe — die height:100%-Kette bricht sonst
   (Zwischen-Container ohne durchgehende Höhe) und das iframe kollabiert auf ~150px. */
.mud-dialog-fullscreen .mud-dialog-content {
    padding: 0;
    overflow: hidden;
}

.mud-dialog-fullscreen .pdf-container {
    max-width: 100%;
    max-height: none;
    height: calc(100vh - 64px);
    padding: 0;
    overflow: hidden;
}

.mud-dialog-fullscreen .pdf-container > div {
    height: 100%;
}

.mud-dialog-fullscreen #pdf-viewer {
    height: calc(100vh - 64px);
    min-height: calc(100vh - 64px);
    width: 100%;
    border: none;
    display: block;
}

/* ===== eID QR-Code ===== */

.mud-typography-body1 img[src^="data:image"],
.mud-typography-body1 img[alt*="QR"],
.mud-typography-body1 img[alt*="qr"],
.mud-typography-body1 img[alt*="eID"],
.mud-typography-body1 img[alt*="eid"] {
    display: block;
    max-width: 250px;
    max-height: 250px;
    margin: 1rem auto;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== Fokus-Indikatoren (Barrierefreiheit WCAG 2.4.7) ===== */
.chat-clear-btn:focus-visible,
.chat-header-icon-btn:focus-visible,
.citation-chip:focus-visible,
.task-panel-header:focus-visible,
.task-result-preview:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #594ae2);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip-Link-Ziel: programmatischer Fokus auf den Container soll keinen
   grossen Rahmen zeigen (die Kind-Elemente behalten ihren focus-visible-Ring). */
#chat-input-main:focus {
    outline: none;
}

.mud-typography-body1 img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ===== Bewegung reduzieren (WCAG 2.3.3 / Betriebssystem-Praeferenz) =====
   Nutzer mit "Bewegung reduzieren" (Windows/macOS/iOS) bekommen keine
   Puls-/Fade-/Slide-Animationen und kein Smooth-Scroll. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Zeile, deren Gespraech im Details-Fenster offen ist (Admin > Audit). */
.audit-row-selected > td {
    background: var(--mud-palette-action-default-hover);
    box-shadow: inset 3px 0 0 0 var(--mud-palette-primary);
}

/* Blockierte Anfrage (Guard) - kritischer Fall, in der Liste sofort erkennbar. */
.audit-row-blocked > td {
    box-shadow: inset 3px 0 0 0 var(--mud-palette-error);
}

/* ===== Diagramme lesbar und mitskalierend (FRN 2026-08-31) =====
   MudBlazor rendert seine Charts als inline-SVG mit fester viewBox (650x350). Feste
   Pixel-Hoehen liessen das Diagramm auf breiten Karten winzig und mittig stehen; der
   frueher gesetzte preserveAspectRatio="none" streckte es zwar auf die Kartenbreite,
   verzerrte dabei aber Achsenbeschriftung und Linien (unleserlich, siehe Snagit-Befund).
   Loesung: Container skaliert mit Breite/Zoom (vw-basierte clamp-Hoehe), das SVG behaelt
   sein Seitenverhaeltnis (Browser-Default xMidYMid meet) -> Schrift und Linien wachsen
   gleichmaessig mit. Alle Werte sind relativ, damit Browser-Zoom und Fensterbreite wirken.
   Die Spanne ist bewusst knapp gehalten (FRN 2026-09-02): ein Diagramm ist eine Kachel im
   Dashboard, kein Bildschirmfueller -- auf breiten Monitoren wurde es sonst zu hoch. */
.nora-chart {
    width: 100% !important;
    /* 07.09.2026 (FRN): die Diagramme waren in Übersicht und Audit zu klein — Spanne angehoben,
       Obergrenze bleibt, damit ein Diagramm auf breiten Monitoren keine Bildschirmseite füllt. */
    height: clamp(260px, 24vw, 440px) !important;
    max-width: 100%;
}

.nora-chart svg {
    width: 100%;
    height: 100%;
}

/* Donut/Pie: quadratisch, darum eigene, kleinere Spanne. */
.nora-chart-donut {
    width: 100% !important;
    height: clamp(190px, 15vw, 300px) !important;
}

.nora-chart-donut svg {
    width: 100%;
    height: 100%;
}

/* Legende unterhalb des Diagramms soll mitwachsen statt auf 12px zu kleben. */
.nora-chart-legend {
    font-size: clamp(0.75rem, 0.9vw, 0.95rem);
}

/* Stacktrace-Auszuege im Log-Panel: umbrechen statt ueber den Container laufen. */
.nora-log-detail {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 18rem;
    overflow-y: auto;
}
