html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
    font-size: var(--type-ramp-base-font-size);
    line-height: var(--type-ramp-base-line-height);
    font-weight: var(--font-weight);
    color: var(--neutral-foreground-rest);
    background: var(--neutral-fill-layer-rest);
    --accent-fill-rest: #0a1a44;
    --accent-fill-hover: #112b6f;
    --accent-fill-active: #143485;
    --accent-fill-focus: #0a1a44;
}

a, .btn-link {
    color: #0a1a44;
}

.btn-primary {
    color: #fff;
    background-color: #0a1a44;
    border-color: #0a1a44;
}

.btn-primary:hover {
    background-color: #0d2359;
    border-color: #0d2359;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #8eb3d7;
}

.content {
    padding-top: 1.1rem;
}

/* FluentUI controls are custom elements that default to vertical-align: baseline,
   which makes buttons sit lower than adjacent text/inputs and get clipped inside
   data-grid cells. Align them to the middle of the line and center grid-cell content. */
fluent-button,
fluent-anchor,
fluent-text-field,
fluent-number-field,
fluent-text-area,
fluent-select,
fluent-combobox,
fluent-checkbox,
fluent-switch,
fluent-badge,
fluent-progress-ring {
    vertical-align: middle;
}

/* FluentDataGrid renders a real <table>; its cells (td[b-...]) have `overflow: hidden`
   plus 6px vertical padding. A button is taller than the text line box, so its bottom
   overflows the cell and gets clipped. Flip overflow to visible only on cells that hold
   a button/anchor (via :has) so text columns keep their ellipsis truncation, and trim the
   vertical padding so the control sits centered. */
.fluent-data-grid td:has(fluent-button),
.fluent-data-grid td:has(fluent-anchor) {
    overflow: visible !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    vertical-align: middle;
}

/* Striped rows on every data grid for readability (FluentDataGrid renders a real <table>). */
.fluent-data-grid tbody tr:nth-child(even) {
    background-color: #f3f6fa;
}

/* Action buttons and badges rendered inside DataTables cells. */
.dt-action {
    cursor: pointer;
    border: 1px solid #c5ced9;
    border-radius: 4px;
    background: #fff;
    color: #0a1a44;
    padding: 0.2rem 0.6rem;
    margin: 0.1rem 0.15rem 0.1rem 0;
    font-size: 0.85rem;
}

.dt-action:hover {
    background: #eef3f8;
}

.dt-action-accent {
    background: #0a1a44;
    border-color: #0a1a44;
    color: #fff;
}

.dt-action-accent:hover {
    background: #112b6f;
}

.dt-badge {
    display: inline-block;
    background: #0a1a44;
    color: #fff;
    border-radius: 10px;
    padding: 0.1rem 0.55rem;
    font-size: 0.78rem;
}

/* Coloured badge variants (audit status/cache etc.). */
.dt-badge-ok { background: #1c8f63; }
.dt-badge-error { background: #c0392b; }
.dt-badge-info { background: #2f66e0; }
.dt-badge-muted { background: #6b7280; }

/* /admin/import: the three import sections (Queries / Rules / Schema) as side-by-side cards. */
.import-cards { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin: 1rem 0; }
.import-card { flex: 1 1 0; min-width: 220px; border: 1px solid #d9dfeb; border-radius: 8px; padding: .75rem .9rem; background: #fff; }
.import-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.import-card-head h2 { margin: 0; font-size: 1rem; }

/* Read-only modal for long audit content (SQL / error / conversation). */
.audit-modal-body { max-height: 60vh; overflow: auto; margin: .5rem 0; }
.audit-modal-body pre { white-space: pre-wrap; word-break: break-word; font-family: "Cascadia Code", ui-monospace, Consolas, monospace; font-size: .82rem; line-height: 1.5; margin: 0; }
.dt-edit-dialog.audit-modal { width: min(900px, 92vw); }

/* Dashboard header row: title left, edit/save/cancel actions top-right. */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.dashboard-toolbar h1 {
    margin: 0;
}

.dashboard-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- Dashboard WYSIWYG editor: live board (left) + inspector panel (right) ---- */
.dashboard-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}
.dashboard-editor .dashboard-board { min-width: 0; }
.editor-empty {
    color: var(--neutral-foreground-hint, #767676);
    border: 1px dashed #c6cdd6;
    border-radius: 8px;
    padding: 1rem;
    margin: 0 0 .5rem;
}
/* While editing, mark the board as a drop area and reveal the drag handle on each tile. */
.dashboard-editor .grid-stack { outline: 1px dashed #c6cdd6; outline-offset: 6px; border-radius: 8px; min-height: 140px; }
.grid-stack-item.tile-highlight > .grid-stack-item-content {
    outline: 2px solid var(--accent-fill-rest, #0a1a44);
    outline-offset: -1px;
}

.dash-inspector { display: flex; flex-direction: column; gap: .8rem; position: sticky; top: .5rem; }
.dash-inspector .card {
    background: #fff;
    border: 1px solid #d6dbe1;
    border-radius: 10px;
    padding: .9rem;
}
.dash-inspector .card h2 {
    margin: 0 0 .6rem;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--neutral-foreground-hint, #767676);
}
.dash-inspector .field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .6rem; }
.dash-inspector .field label { font-size: .8rem; font-weight: 600; }
.inspector-toggle { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.inspector-add { display: flex; gap: .5rem; }
.inspector-add .fluent-button { flex: 1; }
.inspector-count { color: var(--neutral-foreground-hint, #767676); font-weight: 400; }
.inspector-tiles { display: flex; flex-direction: column; gap: .2rem; }
.inspector-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .4rem .45rem; border: 1px solid transparent; border-radius: 7px;
}
.inspector-row:hover { background: #f4f6f9; border-color: #e2e7ee; }
.inspector-chip { font-size: .62rem; padding: .05rem .4rem; border-radius: 999px; background: #e7ecf6; color: #263040; flex: none; }
.inspector-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.inspector-row-actions { display: flex; gap: .15rem; opacity: 0; }
.inspector-row:hover .inspector-row-actions { opacity: 1; }

/* Small icon buttons shared by the inspector rows and the per-tile edit overlay. */
.inspector-row-actions .iconbtn,
.tile-edit-actions .iconbtn {
    width: 1.5rem; height: 1.5rem; border-radius: 6px; border: 1px solid #d6dbe1; background: #fff;
    color: #6b7685; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; line-height: 1;
}
.inspector-row-actions .iconbtn:hover,
.tile-edit-actions .iconbtn:hover { color: #1b2430; border-color: var(--accent-fill-rest, #0a1a44); }
.inspector-row-actions .iconbtn.danger:hover,
.tile-edit-actions .iconbtn.danger:hover { color: #fff; background: #c62828; border-color: #c62828; }

/* "Bearbeiten" badge in the top toolbar while editing. */
.dashboard-edit-badge { font-size: .8rem; font-weight: 600; color: var(--accent-fill-rest, #0a1a44); background: #e7ecf6; padding: .2rem .6rem; border-radius: 999px; }

/* Layout save/cancel bar attached to the top of the board — makes clear these govern the arrangement only. */
.board-edit-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: #eef3ff; border: 1px solid #d3def2; border-radius: 8px; padding: .5rem .7rem; margin-bottom: .6rem; }
.board-edit-hint { font-size: .8rem; color: #44506a; flex: 1 1 12rem; }
.board-edit-actions { display: flex; gap: .5rem; }

/* Per-tile edit affordances, shown in edit mode: a drag grip + ⚙/✕ overlaid on each tile. */
.grid-stack-item-content { position: relative; }
.tile-edit-overlay { position: absolute; top: 4px; left: 6px; right: 6px; display: flex; align-items: center; justify-content: space-between; z-index: 6; pointer-events: none; }
.tile-edit-overlay .tile-drag, .tile-edit-overlay .tile-edit-actions { pointer-events: auto; }
.tile-edit-actions { display: flex; gap: .15rem; opacity: 0; }
.grid-stack-item:hover .tile-edit-actions { opacity: 1; }

@media (max-width: 900px) {
    .dashboard-editor { grid-template-columns: 1fr; }
    .dash-inspector { position: static; }
}

/* KPI "LiveTile": a big number + label + delta + optional sparkline. Accent defaults to the app colour;
   a per-tile colour can be set via the --kpi-accent variable (KpiTile inline style). */
.kpi-tile-content { padding: .7rem .9rem; display: flex; }
.kpi-tile {
    --kpi-accent: var(--accent-fill-rest, #0a1a44);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    width: 100%;
    height: 100%;
}
.kpi-row { display: flex; align-items: center; gap: .7rem; }
.kpi-icon {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--kpi-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
/* EntityIcon's scoped .app-icon carries margin-right:.5rem (fine inline), but in the flex-centred circle that
   right margin shoves the glyph off-centre. Zero it here — the row's own gap handles icon↔text spacing. The
   extra class beats the scoped rule's specificity, so no !important is needed. */
.kpi-row .kpi-icon .app-icon { margin-right: 0; }
.kpi-body { min-width: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: .82rem; color: var(--neutral-foreground-hint, #767676); }
.kpi-error { font-size: 1.6rem; font-weight: 700; color: var(--neutral-foreground-hint, #767676); }
.kpi-delta { font-size: .8rem; display: flex; align-items: center; gap: .3rem; margin-top: .1rem; }
.kpi-delta.good { color: #2e7d32; }
.kpi-delta.bad { color: #c62828; }
.kpi-delta-caption { color: var(--neutral-foreground-hint, #767676); }
.kpi-spark { width: 100%; height: 28px; margin-top: auto; color: var(--kpi-accent); }

/* Dark per-tile background: flip the tile's text to light for contrast (set by the dashboard view). */
.kpi-tile-content--dark .kpi-value,
.kpi-tile-content--dark .kpi-error { color: #fff; }
.kpi-tile-content--dark .kpi-label,
.kpi-tile-content--dark .kpi-delta-caption { color: rgba(255, 255, 255, .75); }
.kpi-tile-content--dark .kpi-delta.good { color: #66bb6a; }
.kpi-tile-content--dark .kpi-delta.bad { color: #ef5350; }

/* "Stand: HH:mm" — when the dashboard tiles last ran, next to the refresh button. */
.dashboard-updated {
    font-size: .8rem;
    color: var(--neutral-foreground-hint, #767676);
    white-space: nowrap;
}
.dashboard-countdown { font-variant-numeric: tabular-nums; opacity: .85; }

/* Dashboard grid tiles (gridstack). Full-height flex column so the body (chart/table) fills the tile. */
.grid-stack-item-content {
    background: #fff;
    border: 1px solid #d6dbe1;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tile-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex: 0 0 auto;
}

.tile-header .tile-title {
    font-weight: 600;
    flex: 1 1 auto;
}

/* Drag handle — only interactive in edit mode (grid is static otherwise). */
.tile-drag {
    cursor: move;
    color: #7a878e;
    user-select: none;
}

.grid-stack.grid-stack-static .tile-drag {
    display: none;
}

.tile-body {
    /* Fills the remaining tile height (flex child) and is itself a flex column so a chart
       (chart-canvas-wrap.fill) stretches to the free space while a table scrolls. */
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Chart container: fixed height by default (e.g. /ask, report view); fills its flex parent inside dashboard tiles. */
.chart-canvas-wrap {
    position: relative;
    height: 400px;
    overflow: auto;
}

/* Inner sizer: normally fills the wrap; chart-interop grows it for dense bar charts so the wrap scrolls. */
.chart-scroll {
    position: relative;
    height: 100%;
    width: 100%;
}

.chart-canvas-wrap.fill {
    height: auto;
    flex: 1 1 auto;
    min-height: 8rem;
}

/* Non-compact chart controls (/ask, report view): chart-type select + "Gesamt anzeigen" checkbox. */
.chart-controls { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }

/* Chart settings modal (Diagramm-Einstellungen) — also the KPI tile config modal. */
.chart-settings-dialog { min-width: 380px; max-width: 440px; }
.chart-settings {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

/* The settings modal can be tall (many fields, plus open dropdowns). Scroll the full-viewport backdrop, not the
   dialog content — an overflow container would clip a FluentSelect's option list (options vanishing behind the
   next field). Scoped to this modal so other centered dialogs are unaffected. */
.dt-edit-backdrop:has(.chart-settings-dialog) {
    align-items: flex-start;
    overflow-y: auto;
    padding: 1.5rem 0;
}

/* Cap every dropdown's option list (app-wide) so a long list scrolls inside the dropdown (like Tom Select)
   instead of growing tall enough to push the modal/page. All selects are the searchable FluentCombobox now. */
fluent-select::part(listbox),
fluent-combobox::part(listbox) {
    max-height: 300px;
    overflow-y: auto;
}

/* Icon option row: the glyph to the left of the label. */
.icon-option { display: inline-flex; align-items: center; gap: .5rem; }
/* (#1) wider inputs: ~320px instead of the FluentUI ~280px default */
.chart-settings fluent-combobox,
.chart-settings fluent-text-field,
.chart-settings fluent-number-field,
.chart-settings .chart-settings-select { width: 320px; }
/* (#3) tighten the gap between a field's label and its control by ~8px (4px is the label's own
   margin; -4px removes it and pulls the control up another ~4px). !important beats FluentUI's own
   scoped label style, which otherwise wins at equal specificity. Adjust this value to taste. */
.chart-settings .fluent-input-label { margin-bottom: -4px !important; }
.chart-settings-group { display: flex; flex-direction: column; gap: .25rem; }
.chart-settings-group > label { font-size: .8rem; font-weight: 600; }
.chart-settings-select { padding: .3rem .4rem; border-radius: 4px; border: 1px solid var(--neutral-stroke-rest, #c0c0c0); }

/* Fehlerprotokoll (log viewer) */
.log-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.log-hint { margin: 0 0 .3rem; font-size: .8rem; color: var(--neutral-foreground-hint, #767676); }
.log-content {
    max-height: 65vh;
    overflow: auto;
    padding: .75rem 1rem;
    background: var(--neutral-fill-secondary, #f5f5f5);
    border: 1px solid var(--neutral-stroke-rest, #e0e0e0);
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
    font-size: .8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Notice shown when a large result is clipped to the first N categories (browser-freeze guard). */
.chart-truncated {
    margin: 0 0 .3rem;
    color: var(--neutral-foreground-hint, #767676);
    font-size: .8rem;
    font-style: italic;
}

/* Small multiples ("Nebeneinander"): styled to read as ONE chart — shared title/subtitle, a single legend
   mapping each facet to its colour, a shared y-scale, and borderless panels in a row. */
.chart-canvas-wrap.facets { height: auto; position: static; }
.chart-facets { display: flex; flex-direction: column; gap: .25rem; width: 100%; }
.chart-facets-title { font-weight: 600; font-size: .95rem; text-align: center; }
.chart-facets-subtitle { font-size: .82rem; color: var(--neutral-foreground-hint, #767676); text-align: center; }
.chart-facets-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .15rem 1rem; margin: .1rem 0 .3rem; font-size: .8rem; }
.chart-facets-ytitle { color: var(--neutral-foreground-hint, #767676); font-size: .78rem; }
.chart-facets-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.chart-facets-legend-swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.chart-facets-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .4rem 1rem; }
.chart-facet { display: flex; flex-direction: column; gap: .15rem; padding: 0 .2rem; }
.chart-facet-title { font-size: .8rem; font-weight: 600; text-align: center; }
.chart-facet-canvas { position: relative; height: 220px; }

/* Dashboard tile-header "Gesamt" (Σ) toggle next to the chart-type picker + Tabelle button. */
.tile-total-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid #d9dfeb; border-radius: 6px; background: #fff; color: #303540; font-weight: 700; cursor: pointer; }
.tile-total-toggle:hover { background: #eef3f8; }
.tile-total-toggle.active { background: #0a1a44; color: #fff; border-color: #0a1a44; }

.tile-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4rem;
    padding: 1rem;
}

.tile-error {
    color: #b4442f;
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem;
}

/* OnTelligence-style inline editing: whole tile drags, light-blue outline while editing. */
.grid-stack.grid-editing .grid-stack-item-content {
    outline: 2px solid #7db3f0;
    outline-offset: -2px;
    cursor: move;
    box-shadow: 0 0 0 3px rgba(125, 179, 240, 0.18);
}

/* Resize handle: double size, always visible in edit mode, light-blue arrow. */
.grid-stack > .grid-stack-item > .ui-resizable-se {
    width: 34px;
    height: 34px;
    right: 1px;
    bottom: 1px;
    opacity: 1;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%234a90d9" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');
    background-size: 22px 22px;
}

/* Lightweight edit dialog used when moving in-grid editing out of DataTables. */
.dt-edit-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 68, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.dt-edit-dialog {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    min-width: 22rem;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(10, 26, 68, 0.3);
}

.dt-edit-dialog .dt-edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Data-source create/edit modal: a stable width so the many fields (and the long read-only connection-string
   preview) fill the dialog instead of stretching it, and a height cap so the tall "Einzelne Felder" form scrolls
   inside the modal rather than off-screen. */
.dt-edit-dialog.datasource-dialog {
    width: min(34rem, 92vw);
    max-height: 85vh;
    overflow-y: auto;
}
.dt-edit-dialog.datasource-dialog .modal-form-body { min-width: 0; }
.dt-edit-dialog.datasource-dialog fluent-text-field,
.dt-edit-dialog.datasource-dialog fluent-number-field,
.dt-edit-dialog.datasource-dialog fluent-combobox { width: 100%; }

.dt-edit-dialog ::deep fluent-text-field {
    width: 100%;
    margin-bottom: 0.5rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.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."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Persistent warning shown to the Systemadmin while training changes await embedding sync. */
.sync-warning {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 1.5rem 0;
    padding: 0.6rem 1rem;
    border: 1px solid #b30000;
    border-left: 4px solid #b30000;
    border-radius: 4px;
    background-color: #fdecea;
    color: #8a0000;
    font-size: 0.9rem;
}

.sync-warning-text {
    flex: 1 1 auto;
}

.sync-warning-action {
    flex: 0 0 auto;
    font-weight: 600;
    color: #8a0000;
    text-decoration: underline;
}

/* Meine-Reports nav tree: folders as normal entries + report links, consistent with the sidebar.
   Global (not scoped) so it also styles the NavLink anchors rendered by child components. */
.nav-tree-folder {
    list-style: none;
}

.nav-tree-summary,
.nav-tree-link {
    display: flex;
    align-items: center;
    color: #59636e;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    min-height: 1.6rem;
    padding: 0.3rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.nav-tree-summary {
    list-style: none;
}

.nav-tree-summary::-webkit-details-marker {
    display: none;
}

.nav-tree-summary:hover,
.nav-tree-link:hover {
    background-color: #eef3f8;
    color: #0a1a44;
}

.nav-tree-link.active {
    background-color: #0a1a44;
    color: #fff;
}

.tw-caret {
    display: inline-block;
    width: 0.7rem;
    margin-right: 0.25rem;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

details[open] > .nav-tree-summary .tw-caret {
    transform: rotate(90deg);
}

/* Occupies the same width as .tw-caret so leaf items (no caret) align their icon
   with folder items at the same nesting level. */
.tw-caret-spacer {
    display: inline-block;
    width: 0.7rem;
    margin-right: 0.25rem;
}

.tw-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* Shrink within the fixed-width sidebar so long names truncate (…) instead of overflowing. */
    flex: 1 1 auto;
    min-width: 0;
}

/* Caret + icons keep their size while only the label truncates. */
.nav-tree-summary > .app-icon,
.nav-tree-link > .app-icon,
.tw-caret,
.tw-caret-spacer {
    flex: 0 0 auto;
}

/* Two-pane Explorer (reports, dashboards, report groups) + share panel. Global so all pages share it. */
.explorer { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
@media (min-width: 780px) { .explorer { grid-template-columns: 280px 1fr; align-items: start; } }
.pane { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 8px; overflow: hidden; min-height: 16rem; }
.pane-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .5rem .6rem; border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0); background: var(--neutral-layer-2, #f6f7fb); }
.list-title { font-weight: 600; margin-right: auto; }
.tree { list-style: none; margin: 0; padding: .4rem; }
.tree li { list-style: none; }
.tnode { display: flex; align-items: center; gap: .45rem; padding: .34rem .5rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.tnode:hover { background: var(--neutral-layer-3, #eef1f7); }
.tnode.sel { background: var(--accent-fill-rest, #2f66e0); color: #fff; }
.rlist { list-style: none; margin: 0; padding: .4rem; display: flex; flex-direction: column; gap: .1rem; }
.rrow { display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem; border-radius: 6px; cursor: pointer; }
.rrow:hover { background: var(--neutral-layer-3, #eef1f7); }
.rrow.sel { background: var(--accent-fill-rest, #2f66e0); color: #fff; }
.rtitle { margin-right: auto; }
.ico { opacity: .8; }
.empty { padding: 1rem; color: var(--neutral-foreground-hint, #6b7280); }
.modal-note { margin: 0 0 .5rem; color: var(--neutral-foreground-hint, #6b7280); }
.report-share-list { padding-left: 1.25rem; }
.report-share-list li { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; }
.report-share-row { display: flex; align-items: center; gap: .5rem; margin: .35rem 0 .75rem; }

/* Unified admin/system page shell — same header rhythm as the report menu editor. Global so it tags nested component markup. */
.admin-page { display: flex; flex-direction: column; gap: 1rem; }
.admin-head { display: flex; align-items: flex-start; gap: 1rem 1.5rem; flex-wrap: wrap; }
.admin-head-text { flex: 1 1 22rem; min-width: 0; }
.admin-back { border: none; background: none; padding: 0; margin: 0 0 .35rem; color: var(--accent-fill-rest, #2f66e0); cursor: pointer; font-size: .85rem; }
.admin-back:hover { text-decoration: underline; }
.admin-title { margin: 0 0 .3rem; font-size: 1.5rem; font-weight: 600; }
.admin-intro { margin: 0; color: var(--neutral-foreground-hint, #6b7280); font-size: .9rem; max-width: 72ch; }
.admin-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.admin-panel { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 8px; padding: 1rem; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
/* Admin master-detail reuses the explorer grid; detail pane gets comfortable padding. */
.admin-detail { padding: 1rem; }
.admin-detail-head { display: flex; align-items: flex-start; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.admin-detail-head .admin-actions { margin-left: auto; }
.admin-kv { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .3rem .9rem; font-size: .9rem; margin: .25rem 0 1rem; }
.admin-kv dt { color: var(--neutral-foreground-hint, #6b7280); margin: 0; }
.admin-kv dd { margin: 0; }

/* Status chips + segmented switch for the users/access admin pages. */
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; padding: .08rem .5rem; border-radius: 999px; background: var(--accent-fill-rest, #2f66e0); color: #fff; }
.chip.good { background: #e3f3ec; color: #1c8f63; }
.chip.off { background: #eceff4; color: #6c7789; }
.chip.warn { background: #f6ecd6; color: #9a6b16; }
.chip.plain { background: var(--neutral-layer-3, #eef1f7); color: var(--neutral-foreground-rest, #303540); }
.seg { display: inline-flex; border: 1px solid var(--neutral-stroke-strong, #c3cbdb); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: .85rem; padding: .3rem 1rem; border: none; background: var(--neutral-layer-1, #fff); color: var(--neutral-foreground-rest, #45536b); cursor: pointer; }
.seg button.on { background: var(--accent-fill-rest, #2f66e0); color: #fff; }
.admin-searchbox { border: 1px solid var(--neutral-stroke-strong, #c3cbdb); border-radius: 7px; padding: .3rem .55rem; font-size: .85rem; width: calc(100% - .8rem); margin: .3rem .4rem .4rem; }
.section-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--neutral-foreground-hint, #6b7280); margin: 1.1rem 0 .4rem; }
.checkrow { display: flex; align-items: center; gap: .5rem; padding: .25rem .3rem; }
.rlist .mini { color: var(--neutral-foreground-hint, #6b7280); font-size: .78rem; margin-left: auto; }

/* Two-list transfer — report/dashboard editors (ReportTransfer) and the access grant lists. */
.transfer { display: grid; grid-template-columns: 1fr; gap: .8rem; margin-top: 1rem; align-items: stretch; }
@media (min-width: 820px) { .transfer { grid-template-columns: 1fr auto 1fr; } }
.transfer .panel { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-height: 16rem; }
.transfer .panel-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; background: var(--neutral-layer-2, #f6f7fb); border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0); font-weight: 600; font-size: .85rem; }
.transfer .panel-head .count { margin-left: auto; font-weight: 500; color: var(--neutral-foreground-hint, #6b7280); font-size: .8rem; }
.transfer .panel-body { padding: .4rem; overflow: auto; flex: 1; }
.transfer .panel-body.drop-hover { outline: 2px dashed var(--accent-fill-rest, #2f66e0); outline-offset: -4px; background: var(--neutral-layer-3, #eef1f7); }
.arrow-col { display: flex; flex-direction: row; gap: .5rem; align-items: center; justify-content: center; }
@media (min-width: 820px) { .arrow-col { flex-direction: column; } }
.arrow-btn { width: 2.3rem; height: 2.3rem; border-radius: 8px; border: 1px solid var(--neutral-stroke-strong, #c3cbdb); background: var(--neutral-layer-1, #fff); color: var(--accent-fill-rest, #2f66e0); font-size: 1.1rem; cursor: pointer; }
.arrow-btn.accent { background: var(--accent-fill-rest, #2f66e0); border-color: var(--accent-fill-rest, #2f66e0); color: #fff; }
.arrow-btn:disabled { opacity: .4; cursor: default; }
.xfer-row { display: flex; align-items: center; gap: .5rem; padding: .38rem .5rem; border-radius: 6px; cursor: grab; }
.xfer-row:active { cursor: grabbing; }
.xfer-row:hover { background: var(--neutral-layer-3, #eef1f7); }
.xfer-row.sel { background: var(--accent-fill-rest, #2f66e0); color: #fff; }
.xfer-row .grip { color: var(--neutral-foreground-hint, #9aa4b2); cursor: grab; }
.xfer-row .name { margin-right: auto; }
.xfer-mini { border: 1px solid var(--neutral-stroke-strong, #c3cbdb); background: var(--neutral-layer-1, #fff); color: inherit; border-radius: 5px; padding: 0 .35rem; font-size: .8rem; line-height: 1.5; cursor: pointer; }
.xfer-mini.danger { color: #b4442f; }
.xfer-group { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--neutral-foreground-hint, #6b7280); padding: .4rem .5rem .15rem; }
.tnode.xfer-src { cursor: grab; }
.tnode.xfer-src.sel { background: var(--accent-fill-rest, #2f66e0); color: #fff; border-radius: 6px; }
.editor-form { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 10px; background: var(--neutral-layer-2, #f6f7fb); padding: 1rem 1.1rem; }
.editor-actions { display: flex; gap: .5rem; margin-top: 1.25rem; }

/* SQL editor card on the report view (dedicated Ausführen/Speichern/Zurücksetzen + status). */
.sql-editor { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 8px; overflow: hidden; margin: .75rem 0; }
.sql-editor-head { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; background: var(--neutral-layer-2, #f6f7fb); font-weight: 600; font-size: .85rem; cursor: pointer; list-style: none; user-select: none; }
.sql-editor-head::-webkit-details-marker { display: none; }
.sql-editor[open] > .sql-editor-head { border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0); }

/* Verlauf as a card (white) matching the SQL-editor card. */
.report-thread { border: 1px solid var(--neutral-stroke-rest, #e0e0e0); border-radius: 8px; overflow: hidden; margin: .75rem 0; background: #fff; }
.report-thread > summary { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; background: #fff; font-weight: 600; font-size: .85rem; cursor: pointer; list-style: none; user-select: none; }
.report-thread > summary::-webkit-details-marker { display: none; }
.report-thread[open] > summary { border-bottom: 1px solid var(--neutral-stroke-rest, #e0e0e0); }
.report-turns { margin: 0; padding: .6rem .9rem; }

/* Shared caret for the report cards (rotates when open). */
.report-thread > summary .tw-caret,
.sql-editor > .sql-editor-head .tw-caret { transition: transform .15s ease; }
.report-thread[open] > summary .tw-caret,
.sql-editor[open] > .sql-editor-head .tw-caret { transform: rotate(90deg); }
.sql-editor-area { width: 100%; box-sizing: border-box; border: none; resize: vertical; padding: .65rem .8rem; background: #0b1020; color: #e6edf3; font-family: "Cascadia Code", "SF Mono", ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.55; tab-size: 2; min-height: 8.5rem; display: block; }
.sql-editor-area:focus { outline: 2px solid var(--accent-fill-rest, #2f66e0); outline-offset: -2px; }
.sql-editor-bar { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; flex-wrap: wrap; }
.sql-editor-status { font-size: .82rem; margin-left: .25rem; display: inline-flex; align-items: center; gap: .35rem; }

/* Matrix "Neue Matrix" question box: native textarea (caret-stable) styled to match the app's inputs. */
.matrix-chat-input { width: 100%; box-sizing: border-box; border: 1px solid var(--neutral-stroke-rest, #d0d0d0); border-radius: 6px; padding: .5rem .6rem; font: inherit; resize: vertical; }
.matrix-chat-input:focus { outline: 2px solid var(--accent-fill-rest, #2f66e0); outline-offset: -2px; }
.sql-editor-status::before { content: "\25CF"; font-size: .7rem; }
.sql-editor-status.warn { color: #9a6b16; }
.sql-editor-status.good { color: #1c8f63; }
.sql-editor-status.muted { color: var(--neutral-foreground-hint, #6b7280); }
.sql-editor-continue { display: flex; align-items: center; gap: .5rem; padding: 0 .7rem .65rem; }
.sql-editor-continue > :first-child { flex: 1 1 auto; }

/* Weiterfragen area (available to all report owners, outside the SQL-editor card). */
.report-continue { margin: .5rem 0; }
.continue-preview-bar { display: flex; align-items: center; gap: .5rem; padding: 0 .7rem .35rem; flex-wrap: wrap; }

/* Compact chart-type picker (dashboard tiles): an icon button that opens a small icon+label menu,
   replacing the wide labelled select so it fits next to the Diagramm/Tabelle toggle. */
.chart-type-menu { position: relative; display: inline-block; }
.chart-type-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid #d9dfeb; border-radius: 6px; background: #fff; color: #303540; cursor: pointer; }
.chart-type-toggle:hover { background: #eef3f8; }
.chart-type-toggle .app-icon { font-size: 1.05rem; line-height: 1; }
.chart-type-panel { display: none; position: absolute; left: 0; top: 100%; margin-top: .25rem; min-width: 9rem; background: #fff; border: 1px solid #d9dfeb; border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 35, 63, .18); padding: .25rem; z-index: 1000; }
.chart-type-menu.open .chart-type-panel { display: block; }
.chart-type-option { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .35rem .5rem; border: none; background: none; border-radius: 6px; color: #303540; font-size: .85rem; cursor: pointer; text-align: left; }
.chart-type-option:hover { background: #eef3f8; }
.chart-type-option.active { background: #0a1a44; color: #fff; }
.chart-type-option .app-icon { font-size: 1rem; flex: 0 0 auto; }

/* Left-nav category header cog (replaces the old "Verwalten" entry). */
.nav-cog { margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: inherit; opacity: .6; padding: .25rem .45rem; border-radius: 6px; text-decoration: none; }
.nav-cog:hover { opacity: 1; background: var(--neutral-layer-3, #eef1f7); }
.nav-cog .app-icon { font-size: 1.2rem; }

/* Top-right settings (⚙) dropdown holding Administration + System. */
.topbar-menu { position: relative; }
.topbar-menu { display: inline-flex; align-items: center; }
.topbar-menu-btn { list-style: none; cursor: pointer; color: #fff; display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding: .2rem .4rem; border-radius: 6px; }
.topbar-menu-btn::-webkit-details-marker { display: none; }
.topbar-menu-btn:hover, .topbar-menu[open] .topbar-menu-btn { background: rgba(255, 255, 255, .16); }
.topbar-menu-btn .app-icon { font-size: 1.35rem; line-height: 1; display: block; }
.topbar-menu-panel { position: absolute; right: 0; top: 100%; margin-top: .4rem; min-width: 230px; max-height: 80vh; overflow: auto; background: #fff; color: #303540; border: 1px solid #d9dfeb; border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 35, 63, .18); padding: .35rem; z-index: 1000; }
.topbar-menu-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; padding: .45rem .6rem .2rem; }
/* color !important: the top bar sets ".top-row ::deep a { color:#fff }" at higher specificity. */
.topbar-menu-panel a { display: block; padding: .35rem .6rem; border-radius: 6px; color: #303540 !important; text-decoration: none; font-size: .88rem; }
.topbar-menu-panel a:hover { background: #eef1f7; color: #0a1a44 !important; }

/* "Ansehen als" (view-as) banner — shown only while a Systemadmin impersonation session is active. */
.impersonation-bar { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; padding: .45rem 1rem; background: #7a1f1f; color: #fff; font-size: .85rem; }
.impersonation-exit { border: 1px solid #fff; background: transparent; color: #fff; border-radius: 4px; padding: .12rem .7rem; cursor: pointer; font-size: .82rem; }
.impersonation-exit:hover { background: rgba(255, 255, 255, 0.15); }
