/* Ai Office: eigene Oberfläche über Filament. Reines CSS, keine Fremdquellen. Akzent Orange, nie Lila. */
:root {
    --ao-font: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
    --ao-display: 'Space Grotesk Variable', 'Inter Variable', ui-sans-serif, sans-serif;
    --ao-accent: #ff7a1a;
    --ao-accent-2: #ffb020;
    --ao-cool: #22d3ee;
    --ao-radius: 14px;
    --ao-radius-sm: 10px;
    --ao-control: 40px;
    --ao-ease: cubic-bezier(.22, 1, .36, 1);
    --ao-bg: #f4f5f8;
    --ao-bg-glow-1: rgb(255 122 26 / .10);
    --ao-bg-glow-2: rgb(34 211 238 / .08);
    --ao-surface: rgb(255 255 255 / .72);
    --ao-surface-strong: rgb(255 255 255 / .9);
    --ao-line: rgb(15 23 42 / .09);
    --ao-line-strong: rgb(15 23 42 / .16);
    --ao-text: #10131a;
    --ao-muted: #5b6474;
    --ao-shadow: 0 1px 2px rgb(15 23 42 / .05), 0 12px 32px -16px rgb(15 23 42 / .18);
    --ao-glow: 0 0 0 1px rgb(255 122 26 / .35), 0 8px 28px -8px rgb(255 122 26 / .45);
    --ao-grid: rgb(15 23 42 / .035);
}
.dark {
    --ao-bg: #07090e;
    --ao-bg-glow-1: rgb(255 122 26 / .16);
    --ao-bg-glow-2: rgb(34 211 238 / .10);
    --ao-surface: rgb(20 24 33 / .62);
    --ao-surface-strong: rgb(22 26 36 / .92);
    --ao-line: rgb(255 255 255 / .08);
    --ao-line-strong: rgb(255 255 255 / .16);
    --ao-text: #eef1f6;
    --ao-muted: #97a1b3;
    --ao-shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 18px 40px -22px rgb(0 0 0 / .9);
    --ao-grid: rgb(255 255 255 / .028);
}

/* Grund */
html, body, .fi-body { font-family: var(--ao-font); font-feature-settings: 'cv11', 'ss03'; -webkit-font-smoothing: antialiased; }
.fi-body { background: var(--ao-bg); color: var(--ao-text); isolation: isolate; }
.fi-body::before { content: ''; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
    background: radial-gradient(38vmax 38vmax at 18% 12%, var(--ao-bg-glow-1), transparent 70%), radial-gradient(44vmax 44vmax at 88% 82%, var(--ao-bg-glow-2), transparent 70%);
    animation: ao-drift 26s ease-in-out infinite alternate; }
.fi-body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: linear-gradient(var(--ao-grid) 1px, transparent 1px), linear-gradient(90deg, var(--ao-grid) 1px, transparent 1px); background-size: 48px 48px;
    mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 85%); }
/* Ohne z-index: Sonst liegen Dialoge aus dem Seiteninhalt unter Menü und Kopfzeile. */
.fi-layout, .fi-main-ctn, .fi-simple-layout { position: relative; }
@keyframes ao-drift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.08); } }
::selection { background: rgb(255 122 26 / .35); }
* { scrollbar-width: thin; scrollbar-color: var(--ao-line-strong) transparent; }

/* Überschriften */
.fi-header-heading, .fi-section-header-heading, .fi-modal-heading, .fi-simple-header-heading, .fi-wi-stats-overview-stat-value, .fi-logo { font-family: var(--ao-display); letter-spacing: -.02em; }
.fi-header-heading { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 600; }
.fi-logo { font-size: 1.15rem; font-weight: 700; background: linear-gradient(92deg, var(--ao-accent), var(--ao-accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fi-header-subheading, .fi-section-header-description { color: var(--ao-muted); }

/* Kopfleiste und Seitenleiste */
.fi-topbar, .fi-topbar > nav { background: var(--ao-surface) !important; backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: none; border-bottom: 1px solid var(--ao-line); }
.fi-sidebar, .fi-sidebar-header, .fi-sidebar-nav { background: transparent !important; box-shadow: none; }
.fi-sidebar { background: var(--ao-surface) !important; backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border-right: 1px solid var(--ao-line); }
.fi-sidebar-header { border-bottom: 1px solid var(--ao-line); }
.fi-sidebar-group-label { font-family: var(--ao-display); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ao-muted); }
.fi-sidebar-item-btn { position: relative; border-radius: var(--ao-radius-sm); min-height: 38px; transition: background .25s var(--ao-ease), transform .25s var(--ao-ease), color .2s; }
.fi-sidebar-item-btn:hover { background: rgb(255 122 26 / .08); transform: translateX(2px); }
.fi-sidebar-item.fi-active .fi-sidebar-item-btn { background: linear-gradient(90deg, rgb(255 122 26 / .18), rgb(255 122 26 / .04)); }
.fi-sidebar-item.fi-active .fi-sidebar-item-btn::before { content: ''; position: absolute; left: -.5rem; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: linear-gradient(var(--ao-accent-2), var(--ao-accent)); box-shadow: 0 0 12px var(--ao-accent); }

/* Flächen */
.fi-section:not(.fi-section-not-contained), .fi-ta-ctn, .fi-wi-stats-overview-stat, .fi-wi-chart, .fi-fo-wizard, .fi-in-tabs, .fi-fo-tabs {
    position: relative; background: var(--ao-surface) !important; border: 1px solid var(--ao-line); border-radius: var(--ao-radius) !important; box-shadow: var(--ao-shadow) !important; --tw-ring-shadow: 0 0 #0000;
 }
.fi-wi-stats-overview-stat, .fi-wi-chart { backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.fi-section:not(.fi-section-not-contained)::after, .fi-wi-stats-overview-stat::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
    background: radial-gradient(420px circle at var(--ao-x, 50%) var(--ao-y, 50%), rgb(255 122 26 / .10), transparent 60%); }
.fi-section:hover::after, .fi-wi-stats-overview-stat:hover::after { opacity: 1; }
.fi-section-header { border-bottom-color: var(--ao-line); }
.fi-wi-stats-overview-stat { transition: transform .35s var(--ao-ease), box-shadow .35s var(--ao-ease), border-color .35s; }
.fi-wi-stats-overview-stat:hover { transform: translateY(-3px); border-color: rgb(255 122 26 / .4); box-shadow: var(--ao-glow) !important; }
.fi-wi-stats-overview-stat-value { font-size: 1.9rem; }

/* Einheitliche Bedienelemente */
.fi-btn { min-height: var(--ao-control); border-radius: var(--ao-radius-sm); font-weight: 600; letter-spacing: -.005em; transition: transform .18s var(--ao-ease), box-shadow .25s var(--ao-ease), filter .2s, background .2s; }
.fi-btn.fi-size-xs, .fi-btn.fi-size-sm { min-height: 34px; }
.fi-btn.fi-size-lg, .fi-btn.fi-size-xl { min-height: 48px; }
.fi-btn:hover { transform: translateY(-1px); }
.fi-btn:active { transform: translateY(0) scale(.98); }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled) { color: #1a0d02; background: linear-gradient(135deg, var(--ao-accent-2), var(--ao-accent)); box-shadow: 0 6px 20px -8px rgb(255 122 26 / .7), 0 1px 0 rgb(255 255 255 / .35) inset; }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled) .fi-icon { color: inherit; }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled):hover { box-shadow: 0 10px 28px -8px rgb(255 122 26 / .9), 0 1px 0 rgb(255 255 255 / .4) inset; filter: brightness(1.05); }
.fi-btn.fi-color-gray { background: var(--ao-surface-strong); box-shadow: inset 0 0 0 1px var(--ao-line-strong); }
.fi-btn.fi-color-gray:hover { box-shadow: inset 0 0 0 1px rgb(255 122 26 / .5); }
.fi-icon-btn { border-radius: var(--ao-radius-sm); transition: background .2s, transform .18s var(--ao-ease); }
.fi-icon-btn:hover { background: rgb(255 122 26 / .1); transform: scale(1.06); }
.fi-input-wrp { min-height: var(--ao-control); border-radius: var(--ao-radius-sm) !important; background: var(--ao-surface-strong) !important; box-shadow: inset 0 0 0 1px var(--ao-line-strong) !important; transition: box-shadow .2s, background .2s; }
.fi-input-wrp:focus-within { box-shadow: inset 0 0 0 1px var(--ao-accent), 0 0 0 3px rgb(255 122 26 / .18) !important; }
:where(a, button, [role='button'], input, select, textarea):focus-visible { outline: 2px solid var(--ao-accent); outline-offset: 2px; }
.fi-badge { border-radius: 999px; font-weight: 600; letter-spacing: .005em; }
.fi-tabs { border-radius: var(--ao-radius); background: var(--ao-surface); box-shadow: inset 0 0 0 1px var(--ao-line); backdrop-filter: blur(12px); }
.fi-tabs-item { border-radius: var(--ao-radius-sm); transition: background .2s, color .2s; }
.fi-tabs-item.fi-active { background: rgb(255 122 26 / .14); }

/* Tabellen */
/* Tabellen und Abschnitte tragen bewusst keinen backdrop-filter: Er macht das Element zum Bezugsrahmen für fixierte Menüs, und die Tabelle schneidet sie dann ab. */
.fi-ta-header-cell { font-family: var(--ao-display); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ao-muted); background: transparent !important; }
.fi-ta-table thead tr { background: transparent !important; }
.fi-ta-row { transition: background .18s; }
.fi-ta-row:hover { background: rgb(255 122 26 / .05) !important; }
.fi-ta-table > tbody > tr, .fi-ta-table td, .fi-ta-table th { border-color: var(--ao-line) !important; }
.fi-pagination-item-btn { border-radius: 8px; }

/* Fenster und Menüs */
.fi-modal-window { background: var(--ao-surface-strong) !important; border: 1px solid var(--ao-line-strong); border-radius: 18px !important; backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); box-shadow: 0 40px 80px -30px rgb(0 0 0 / .6) !important; }
.fi-modal-close-overlay { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.fi-dropdown-panel { background: var(--ao-surface-strong) !important; border: 1px solid var(--ao-line); border-radius: var(--ao-radius-sm) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 20px 40px -20px rgb(0 0 0 / .5) !important; }
.fi-no-notification { border-radius: var(--ao-radius) !important; background: var(--ao-surface-strong) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--ao-line); }

/* Anmeldung */
.fi-simple-main { background: var(--ao-surface) !important; border: 1px solid var(--ao-line); border-radius: 20px !important; backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: var(--ao-shadow) !important; animation: ao-rise .7s var(--ao-ease) both; }

/* Seitenwechsel */
#nprogress .bar { height: 2px !important; background: linear-gradient(90deg, var(--ao-accent), var(--ao-accent-2), var(--ao-cool)) !important; box-shadow: 0 0 12px var(--ao-accent); }
#nprogress .peg { box-shadow: 0 0 14px var(--ao-accent), 0 0 6px var(--ao-accent) !important; }
.fi-main.ao-leave { animation: ao-leave .16s ease-in both; }
.fi-main.ao-enter > * { animation: ao-rise .55s var(--ao-ease) both; }
.ao-enter .fi-section, .ao-enter .fi-ta-ctn, .ao-enter .fi-wi-stats-overview-stat, .ao-enter .fi-tabs { animation: ao-rise .6s var(--ao-ease) both; animation-delay: calc(var(--ao-i, 0) * 45ms); }
.ao-enter .fi-ta-row { animation: ao-row .45s var(--ao-ease) both; animation-delay: calc(var(--ao-i, 0) * 18ms + 120ms); }
@keyframes ao-leave { to { opacity: 0; transform: translateY(-6px) scale(.995); filter: blur(2px); } }
@keyframes ao-rise { from { opacity: 0; transform: translateY(14px) scale(.99); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes ao-row { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@view-transition { navigation: auto; }

/* Eigene Seiten */
.ao-os-select, .ao-ho-input, .ao-acc-input { background: var(--ao-surface-strong) !important; border-color: var(--ao-line-strong) !important; border-radius: var(--ao-radius-sm) !important; }
.ao-ho-btn, .ao-acc-opt { border-radius: var(--ao-radius-sm) !important; border-color: var(--ao-line-strong) !important; transition: transform .18s var(--ao-ease), border-color .2s, background .2s; }
.ao-ho-btn:hover, .ao-acc-opt:hover { transform: translateY(-1px); border-color: var(--ao-accent) !important; }
.ao-acc-msg { animation: ao-rise .4s var(--ao-ease) both; }
.ao-acc-msg.user { background: linear-gradient(135deg, var(--ao-accent-2), var(--ao-accent)) !important; color: #1a0d02 !important; }

/* Gesellschaftswahl */
.ao-company-trigger { min-height: var(--ao-control); padding: 0 .8rem !important; border-radius: var(--ao-radius-sm) !important; background: var(--ao-surface-strong) !important; border-color: var(--ao-line-strong) !important; color: var(--ao-text) !important; transition: border-color .2s, box-shadow .25s; }
.ao-company-trigger:hover:not(:disabled) { border-color: var(--ao-accent) !important; box-shadow: 0 0 0 3px rgb(255 122 26 / .14); }
.ao-company-menu { background: var(--ao-surface-strong) !important; border-color: var(--ao-line-strong) !important; border-radius: var(--ao-radius-sm) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.ao-company-item { border-radius: 8px; }
.ao-company-item:hover { background: rgb(255 122 26 / .12) !important; }

/* Leuchtlinie unter der Kopfleiste */
.fi-topbar { position: relative; }
.fi-topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--ao-accent) 30%, var(--ao-cool) 50%, var(--ao-accent-2) 70%, transparent); background-size: 200% 100%; opacity: .55; animation: ao-flow 9s linear infinite; }
@keyframes ao-flow { to { background-position: -200% 0; } }

/* Seitenkopf */
.fi-header-heading { position: relative; width: fit-content; }
.fi-header-heading::after { content: ''; display: block; height: 2px; margin-top: .35rem; width: 2.5rem; border-radius: 2px; background: linear-gradient(90deg, var(--ao-accent), transparent); transition: width .5s var(--ao-ease); }
.fi-header:hover .fi-header-heading::after { width: 100%; }

/* Hauptknopf: Lichtkante beim Überfahren */
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled) { position: relative; overflow: hidden; }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled)::after { content: ''; position: absolute; inset: 0; transform: translateX(-120%) skewX(-18deg); background: linear-gradient(90deg, transparent, rgb(255 255 255 / .55), transparent); }
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-disabled):hover::after { transform: translateX(120%) skewX(-18deg); transition: transform .7s var(--ao-ease); }
.ao-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgb(255 255 255 / .35); transform: scale(0); animation: ao-ripple .55s ease-out forwards; }
@keyframes ao-ripple { to { transform: scale(2.6); opacity: 0; } }

/* Tabellen: Leuchtkante an der aktiven Zeile, Zahlen gleich breit */
.fi-ta-row { position: relative; }
.fi-ta-row:hover > td:first-child { box-shadow: inset 2px 0 0 var(--ao-accent); }
.fi-ta-text, .fi-wi-stats-overview-stat-value, .ao-kpi-table, .ao-acc-kpi, .ao-stb-kpi { font-variant-numeric: tabular-nums; }
.fi-ta-content-loading, .fi-loading-section { position: relative; }

/* Fenster */
.fi-modal-window { animation: ao-pop .32s var(--ao-ease) both; }
@keyframes ao-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.fi-no-notification { animation: ao-slide .4s var(--ao-ease) both; }
@keyframes ao-slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.fi-dropdown-panel { animation: ao-pop .2s var(--ao-ease) both; }

/* Zähler in der Navigation */
.fi-sidebar-item-badge-ctn .fi-badge, .fi-sidebar-item .fi-badge { box-shadow: 0 0 10px -2px currentColor; }

/* Handy: Kopfleiste entlasten, Zielgrößen ab 44 px */
@media (max-width: 767px) {
    .fi-global-search-field { display: none; }
    .ao-company-trigger span { max-width: 7rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .ao-company-switcher { margin-inline-end: .25rem; }
    .fi-btn { min-height: 44px; }
    .fi-input-wrp { min-height: 44px; }
    .fi-header-heading { font-size: 1.45rem; }
    .fi-main { padding-inline: .75rem; }
    .fi-header { gap: .75rem; }
    .fi-ac.fi-align-start, .fi-header-actions-ctn { width: 100%; }
}

/* Eigene Kennzahlenseiten: gleiche Bedienelemente wie überall */
.ao-kpi-bar button, .ao-kpi-bar select, .ao-kpi-bar input { min-height: var(--ao-control); border-radius: var(--ao-radius-sm) !important; background: var(--ao-surface-strong); color: inherit; transition: border-color .2s, transform .18s var(--ao-ease); }
.ao-kpi-bar button:hover { border-color: var(--ao-accent) !important; transform: translateY(-1px); }
.ao-kpi-bar button.on { background: linear-gradient(135deg, var(--ao-accent-2), var(--ao-accent)) !important; border-color: transparent !important; color: #1a0d02 !important; font-weight: 600; }
.ao-kpi-h { font-family: var(--ao-display); border-left-color: var(--ao-accent) !important; }
/* Breite Kennzahlen scrollen in ihrem Rahmen. Worte nie buchstabenweise umbrechen, Namen brauchen Platz. */
.ao-kpi-scroll { overflow-x: auto; max-width: 100%; }
.ao-kpi-table th { white-space: nowrap; }
.ao-kpi-table td:first-child, .ao-kpi-table th:first-child { min-width: 9rem; }
.ao-kpi-table .r { white-space: nowrap; }
.fi-fo-rich-editor-toolbar { flex-wrap: wrap; }

@media (max-width: 767px) {
    .fi-topbar > nav { padding-inline: .75rem !important; }
    .fi-main { max-width: 100vw; overflow-x: clip; }
}

/* Handy: Leiste unten. Sie weicht, solange getippt wird, sonst überdeckt sie das Feld. */
.ao-tabbar { display: none; }
@media (max-width: 1023px) {
    .ao-tabbar { position: fixed; inset: auto 0 0 0; z-index: 25; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); background: var(--ao-surface-strong); border-top: 1px solid var(--ao-line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
    .ao-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 56px; font-size: .7rem; color: var(--ao-muted); }
    .ao-tabbar a.on { color: var(--ao-accent); }
    .ao-tabbar svg { width: 1.4rem; height: 1.4rem; }
    .ao-tabbar .n { position: absolute; top: .3rem; left: calc(50% + .45rem); min-width: 1.1rem; padding-inline: .25rem; border-radius: 999px; background: var(--ao-accent); color: #1a0d02; font-size: .65rem; font-weight: 700; text-align: center; }
    .fi-main-ctn { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    body:has(textarea:focus, input:focus) .ao-tabbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .fi-body::before { transform: none; }
}
@media (max-width: 640px) { .fi-body::after { display: none; } }
