/* ============================================
   FMDashboard — "Noir Amber" Design System
   Portiert aus crm.fm-media.at/assets/css/app.css
   Nur CSS — kein PHP übernommen.
   ============================================ */

/* Webfonts lokal: assets/css/fonts.css (per <link> in layout.php/login.php) */

/* petite-vue FOUC-Guard: alles mit v-cloak bleibt versteckt, bis
   petite-vue mounted hat und das Attribut entfernt. Inklusive
   Fallback-Rules fuer nicht ge-mountete v-if/v-show/v-scope. */
[v-cloak],
[v-cloak] * {
    visibility: hidden !important;
}

:root {
    /* Layout */
    --sidebar-width: 272px;
    --header-height: 64px;

    /* Colors — Noir Amber */
    --fm-bg-deepest: #0A0C12;
    --fm-bg-deep: #0F1118;
    --fm-bg-base: #13151E;
    --fm-bg-raised: #181B26;
    --fm-bg-card: #1C1F2C;
    --fm-bg-card-hover: #202432;
    --fm-bg-input: #12141C;

    --fm-accent: #D4A053;
    --fm-accent-light: #E8BE78;
    --fm-accent-dim: rgba(212, 160, 83, 0.15);
    --fm-accent-glow: rgba(212, 160, 83, 0.25);
    /* Textfarbe auf goldenem Hintergrund — Dark-Mode: nahezu schwarz fuer
       maximalen Kontrast; Light-Mode (siehe unten): weiß. */
    --fm-accent-text: #1A1208;

    --fm-green: #34D399;
    --fm-green-dim: rgba(52, 211, 153, 0.12);
    --fm-blue: #60A5FA;
    --fm-blue-dim: rgba(96, 165, 250, 0.12);
    --fm-red: #F87171;
    --fm-red-dim: rgba(248, 113, 113, 0.12);
    --fm-purple: #A78BFA;
    --fm-purple-dim: rgba(167, 139, 250, 0.12);

    --fm-text-primary: #E4E7F0;
    --fm-text-secondary: #8B92A8;
    --fm-text-muted: #555B73;
    --fm-text-accent: var(--fm-accent);

    /* Borders bewusst etwas kraefig fuer Struktur-Lesbarkeit. */
    --fm-border: rgba(255, 255, 255, 0.10);
    --fm-border-light: rgba(255, 255, 255, 0.06);
    --fm-border-accent: rgba(212, 160, 83, 0.3);

    /* Alias-Variablen fuer Templates (--color-*).
       Tabellen + Karten benutzen `var(--color-border, ...)` mit weissem
       rgba-Fallback — ohne diese Aliasse waeren Trennlinien im Light-Mode
       unsichtbar. */
    --color-border: var(--fm-border);
    --color-surface: var(--fm-bg-card);
    --color-card-bg: var(--fm-bg-card);
    --color-accent: var(--fm-accent);

    --fm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --fm-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --fm-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --fm-shadow-glow: 0 0 24px rgba(212, 160, 83, 0.08);

    --fm-radius-sm: 8px;
    --fm-radius-md: 12px;
    --fm-radius-lg: 16px;
    --fm-radius-xl: 20px;

    --fm-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --fm-transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Semantische Status-Pill-/Button-Farben.
       Werte für Dark-Mode — Light-Mode überschreibt unten mit
       WCAG-AA-tauglichen Werten auf weißem Hintergrund. */
    --fm-pill-success-bg: rgba(80, 200, 120, 0.14);
    --fm-pill-success-text: #8fe3a8;
    --fm-pill-success-border: rgba(80, 200, 120, 0.40);
    --fm-pill-warning-bg: rgba(220, 160, 50, 0.14);
    --fm-pill-warning-text: #f3c481;
    --fm-pill-warning-border: rgba(220, 160, 50, 0.40);
    --fm-pill-danger-bg: rgba(220, 50, 70, 0.12);
    --fm-pill-danger-text: #ff8896;
    --fm-pill-danger-border: rgba(220, 50, 70, 0.40);
    --fm-pill-info-bg: rgba(80, 150, 220, 0.18);
    --fm-pill-info-text: #7db3f5;
    --fm-pill-info-border: rgba(80, 150, 220, 0.40);
    --fm-pill-neutral-bg: rgba(255, 255, 255, 0.05);
    --fm-pill-neutral-text: rgba(255, 255, 255, 0.60);
    --fm-pill-neutral-border: rgba(255, 255, 255, 0.18);
}

/* ============================================
   LIGHT MODE
   ============================================ */
[data-theme="light"] {
    --fm-bg-deepest: #F2F3F8;
    --fm-bg-deep: #FFFFFF;
    --fm-bg-base: #F7F8FB;
    --fm-bg-raised: #EFF0F5;
    --fm-bg-card: #FFFFFF;
    --fm-bg-card-hover: #FAFBFD;
    --fm-bg-input: #F2F3F8;

    --fm-accent: #B8883E;
    --fm-accent-light: #D4A053;
    --fm-accent-dim: rgba(184, 136, 62, 0.1);
    --fm-accent-glow: rgba(184, 136, 62, 0.15);
    --fm-accent-text: #FFFFFF;

    --fm-green: #16A34A;
    --fm-green-dim: rgba(22, 163, 74, 0.08);
    --fm-blue: #2563EB;
    --fm-blue-dim: rgba(37, 99, 235, 0.08);
    --fm-red: #DC2626;
    --fm-red-dim: rgba(220, 38, 38, 0.06);
    --fm-purple: #7C3AED;
    --fm-purple-dim: rgba(124, 58, 237, 0.08);

    --fm-text-primary: #1A1D28;
    --fm-text-secondary: #4A5068;
    --fm-text-muted: #8590A6;
    --fm-text-accent: var(--fm-accent);

    --fm-border: rgba(0, 0, 0, 0.16);
    --fm-border-light: rgba(0, 0, 0, 0.08);
    --fm-border-accent: rgba(184, 136, 62, 0.32);

    --fm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --fm-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --fm-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --fm-shadow-glow: 0 0 24px rgba(184, 136, 62, 0.08);

    /* Status-Pills im Light-Mode — hand-getunt für WCAG-AA-Kontrast
       (>= 4.5:1 für Text auf weißem/karten-weißem Hintergrund). */
    --fm-pill-success-bg: rgba(22, 163, 74, 0.12);
    --fm-pill-success-text: #15803d;
    --fm-pill-success-border: rgba(22, 163, 74, 0.45);
    --fm-pill-warning-bg: rgba(202, 138, 4, 0.14);
    --fm-pill-warning-text: #854d0e;
    --fm-pill-warning-border: rgba(202, 138, 4, 0.45);
    --fm-pill-danger-bg: rgba(220, 38, 38, 0.10);
    --fm-pill-danger-text: #b91c1c;
    --fm-pill-danger-border: rgba(220, 38, 38, 0.45);
    --fm-pill-info-bg: rgba(37, 99, 235, 0.10);
    --fm-pill-info-text: #1d4ed8;
    --fm-pill-info-border: rgba(37, 99, 235, 0.45);
    --fm-pill-neutral-bg: rgba(0, 0, 0, 0.05);
    --fm-pill-neutral-text: #52525b;
    --fm-pill-neutral-border: rgba(0, 0, 0, 0.15);
}

/* Light mode overrides for elements with hardcoded opacity values */
[data-theme="light"] .sidebar nav a:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar nav a.active {
    background: var(--fm-accent-dim);
}

[data-theme="light"] .dashboard-card:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

:root:not([data-theme="light"]) .btn,
:root:not([data-theme="light"]) .btn-logout {
    color: rgba(255, 255, 255, 0.92);
}

:root:not([data-theme="light"]) .btn:hover,
:root:not([data-theme="light"]) .btn-logout:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

:root:not([data-theme="light"]) .btn-logout:hover {
    background: rgba(248, 113, 113, 0.14);
    color: #ffd6da;
}

[data-theme="light"] .status-inactive {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .btn,
[data-theme="light"] .btn-logout {
    color: #2a3142;
}

[data-theme="light"] .btn:hover,
[data-theme="light"] .btn-logout:hover {
    border-color: rgba(0, 0, 0, 0.24);
    color: #1a1d28;
}

[data-theme="light"] .btn-primary,
[data-theme="light"] .btn-primary:hover {
    color: var(--fm-accent-text);
}

[data-theme="light"] .app-content::before {
    opacity: 0.4;
}

[data-theme="light"] .sidebar {
    box-shadow: 1px 0 0 rgba(0,0,0,0.04);
}

[data-theme="light"] .app-header {
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--fm-bg-deepest);
    color: var(--fm-text-primary);
    overflow: hidden;
    height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--fm-text-primary);
}

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

/* ============================================
   TAG BASE — sinnvolle Defaults ohne Klassen
   Reihenfolge pro Rule: position/display -> size -> font -> box -> rest
   ============================================ */

p {
    margin: 0 0 0.6em;
    line-height: 1.55;

    &:last-child { margin-bottom: 0; }
}

small {
    font-size: 0.82em;
    color: var(--fm-text-secondary);
}

strong { font-weight: 600; }
em { font-style: italic; }

hr {
    display: block;
    width: 100%;
    height: 1px;
    margin: 1rem 0;
    background: var(--fm-border);
    border: 0;
}

ul, ol {
    padding-left: 1.2rem;
    margin: 0 0 0.6em;

    &:last-child { margin-bottom: 0; }
}
li { margin-bottom: 0.15em; }

dl { margin: 0; }
dt { font-weight: 600; opacity: 0.75; }
dd { margin: 0 0 0.4em; }

code, kbd, samp {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.1em 0.35em;
    background: var(--fm-bg-input);
    border: 1px solid var(--fm-border-light);
    border-radius: 4px;
}
pre {
    display: block;
    overflow-x: auto;
    padding: 0.75rem 1rem;
    margin: 0 0 0.6em;
    background: var(--fm-bg-input);
    border: 1px solid var(--fm-border-light);
    border-radius: var(--fm-radius-sm);

    code {
        padding: 0;
        background: transparent;
        border: 0;
    }
}

/* ---- Form-Elemente als Tag-Default ---- */

label {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--fm-text-secondary);
    margin-bottom: 0.3rem;
    cursor: pointer;
}

input, textarea, select {
    display: inline-block;
    width: auto;
    font: inherit;
    font-size: 0.9rem;
    color: var(--fm-text-primary);
    padding: 0.5rem 0.7rem;
    margin: 0;
    background: var(--fm-bg-input);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    outline: none;
    transition: border-color var(--fm-transition), box-shadow var(--fm-transition);

    &::placeholder { color: var(--fm-text-muted); }

    &:hover:not(:disabled):not(:focus) {
        border-color: var(--fm-border-accent);
    }
    &:focus {
        border-color: var(--fm-accent);
        box-shadow: 0 0 0 3px var(--fm-accent-dim);
    }
    &:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }
    &[aria-invalid="true"], &.is-invalid {
        border-color: var(--fm-red);
        box-shadow: 0 0 0 3px var(--fm-red-dim);
    }
}

textarea {
    display: block;
    width: 100%;
    min-height: 5rem;
    line-height: 1.5;
    resize: vertical;
}

select {
    padding-right: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--fm-text-secondary) 50%),
                      linear-gradient(135deg, var(--fm-text-secondary) 50%, transparent 50%);
    background-position: calc(100% - 1rem) 50%, calc(100% - 0.65rem) 50%;
    background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
    background-repeat: no-repeat;
    appearance: none;
    cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
    width: 1rem;
    height: 1rem;
    padding: 0;
    margin: 0;
    vertical-align: -2px;
    accent-color: var(--fm-accent);
    cursor: pointer;
}

input[type="file"] {
    padding: 0.3rem 0.4rem;
    font-size: 0.85rem;
    background: transparent;
    border: 1px dashed var(--fm-border);
    cursor: pointer;
}

input[type="range"] {
    padding: 0;
    background: transparent;
    border: 0;
    accent-color: var(--fm-accent);
}

input[type="color"] {
    width: 2.5rem;
    height: 2.2rem;
    padding: 2px;
    cursor: pointer;
}

fieldset {
    padding: 1rem 1.25rem;
    margin: 0 0 1rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);

    &:last-child { margin-bottom: 0; }
}
legend {
    padding: 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fm-text-secondary);
}

form {
    /* Kein globales Margin/Padding — Formulare koennen als Wrapper genutzt
       werden, ohne Layout zu stoeren. */
    margin: 0;
}

/* ---- Buttons ----
   Sanfte Base: setzt nur Font/Cursor/Farbe/Border/Padding. KEIN min-height,
   KEIN automatisches submit=primary. Templates mit eigenem Styling
   (.theme-toggle, .btn-logout, .sidebar nav a etc.) bleiben unberuehrt.
   Primary-Optik immer explizit ueber .btn--primary. */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--fm-text-primary);
    padding: 0.5rem 1rem;
    margin: 0;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    cursor: pointer;
    transition: background var(--fm-transition), border-color var(--fm-transition), color var(--fm-transition), opacity var(--fm-transition);
    white-space: nowrap;

    &:hover:not(:disabled) {
        background: var(--fm-bg-card-hover);
        border-color: var(--fm-border-accent);
    }
    &:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px var(--fm-accent-dim);
    }
    &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

/* ---- Tabellen ---- */

table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
    border-spacing: 0;
}
thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fm-text-secondary);
    padding: 0.65rem 0.9rem;
    background: var(--fm-bg-raised);
    border-bottom: 1px solid var(--fm-border);
}
tbody td {
    padding: 0.6rem 0.9rem;
    color: var(--fm-text-primary);
    border-bottom: 1px solid var(--fm-border-light);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--fm-bg-card-hover); }

/* ---- Dialog ---- */

dialog {
    padding: 0;
    margin: auto;
    color: var(--fm-text-primary);
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    box-shadow: var(--fm-shadow-lg);

    &::backdrop {
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
    }
}

/* Override PicoCSS defaults */
[data-theme="dark"], :root:not([data-theme="light"]) {
    --pico-background-color: var(--fm-bg-deepest);
    --pico-color: var(--fm-text-primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fm-text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fm-text-secondary); }

/* ============================================
   LAYOUT — App Grid
   ============================================ */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    background: var(--fm-bg-deepest);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    grid-row: 1 / -1;
    /* Sidebar bewusst eine Stufe heller als bg-deepest (Body), damit der
       Kontrast zur Content-Flaeche sichtbar bleibt aber das Menue selber
       nicht in dunkler Tiefe verschwindet. */
    background: var(--fm-bg-raised);
    border-right: 1px solid var(--fm-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    z-index: 10;
}

/* Subtle top accent line */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--fm-accent), transparent 80%);
}

.sidebar-brand {
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 1px solid var(--fm-border);
    flex-shrink: 0;
}

.sidebar-brand .brand-mark {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--fm-accent);
    letter-spacing: -0.02em;
}

.sidebar-brand .brand-text {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--fm-text-primary);
    letter-spacing: -0.01em;
}

.sidebar-brand .brand-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fm-accent);
    background: var(--fm-accent-dim);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

.sidebar nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar nav .nav-section {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fm-text-muted);
    font-weight: 700;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 1.5rem;
    color: var(--fm-text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--fm-transition);
    position: relative;
    border: none;
    text-decoration: none;
    margin: 1px 0.5rem;
    border-radius: var(--fm-radius-sm);
}

.sidebar nav a:hover {
    color: var(--fm-text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar nav a .nav-badge {
    margin-left: auto;
}

.sidebar nav a.active {
    color: var(--fm-accent-light);
    background: var(--fm-accent-dim);
}

.sidebar nav a.active .nav-icon {
    color: var(--fm-accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity var(--fm-transition);
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar nav a:hover .nav-icon,
.sidebar nav a.active .nav-icon {
    opacity: 1;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--fm-border);
    flex-shrink: 0;
}

.sidebar-footer .version-tag {
    font-size: 0.7rem;
    color: var(--fm-text-muted);
    letter-spacing: 0.03em;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
    background: var(--fm-bg-deep);
    border-bottom: 1px solid var(--fm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    gap: 1rem;
    z-index: 5;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-left .page-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fm-text-primary);
}

.header-left .breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--fm-text-muted);
}

.header-left .breadcrumb span {
    color: var(--fm-text-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: inherit;
    padding: 0.35rem 0.5rem 0.35rem 0.4rem;
    background: var(--fm-bg-raised);
    border: 1px solid var(--fm-border);
    border-radius: 100px;
    text-decoration: none;
    cursor: pointer;

    &:hover { color: inherit; }
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--fm-accent-dim), var(--fm-accent-glow));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--fm-accent);
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--fm-text-secondary);
}

/* Theme Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 100px;
    background: var(--fm-bg-raised);
    border: 1px solid var(--fm-border);
    cursor: pointer;
    transition: all var(--fm-transition);
    padding: 3px;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--fm-border-accent);
}

.theme-toggle .toggle-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--fm-accent);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.theme-toggle .toggle-thumb svg {
    width: 12px;
    height: 12px;
    stroke: #0A0C12;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Moon icon (dark mode) - thumb on left */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

/* Sun icon (light mode) - thumb on right */
[data-theme="light"] .theme-toggle .toggle-thumb {
    transform: translateX(24px);
}

[data-theme="light"] .theme-toggle .toggle-thumb svg {
    stroke: #FFFFFF;
}

[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

.btn-logout {
    display: inline-flex;
    align-items: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--fm-text-muted);
    padding: 0.4rem 0.9rem;
    background: none;
    border: 1px solid var(--fm-border);
    border-radius: 100px;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--fm-transition);

    &:hover {
        color: var(--fm-red);
        background: var(--fm-red-dim);
        border-color: rgba(248, 113, 113, 0.2);
    }
}

/* Logout ist ein POST-Formular (CSRF). Form + Button sollen exakt wie der
   fruehere Link aussehen; die globale button-Basis darf nicht durchschlagen. */
.logout-form {
    display: inline-flex;
    margin: 0;
}

button.btn-logout {
    gap: 0;
    line-height: inherit;

    &:hover:not(:disabled) {
        background: var(--fm-red-dim);
    }
}

/* ============================================
   CONTENT AREA
   ============================================ */
.app-content {
    padding: 2rem 2.5rem;
    overflow-y: auto;
    background: var(--fm-bg-base);
    position: relative;
}

/* Subtle grain texture overlay */
.app-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.app-content > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.view-enter {
    animation: viewFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.3rem;
}

.dashboard-header .greeting {
    color: var(--fm-text-secondary);
    font-size: 0.9rem;
}

.dashboard-header .greeting strong {
    color: var(--fm-accent);
}

/* Metric Cards Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metrics-row--5 {
    grid-template-columns: repeat(5, 1fr);
}

.metrics-row--6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1280px) {
    .metrics-row--6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.metric-card {
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    padding: 1.25rem 1.35rem;
    position: relative;
    overflow: hidden;
    transition: all var(--fm-transition);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.metric-card:nth-child(1)::before { background: var(--fm-accent); }
.metric-card:nth-child(2)::before { background: var(--fm-blue); }
.metric-card:nth-child(3)::before { background: var(--fm-green); }
.metric-card:nth-child(4)::before { background: var(--fm-purple); }

.metric-card:hover {
    border-color: var(--fm-border-accent);
    box-shadow: var(--fm-shadow-glow);
    transform: translateY(-1px);
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fm-text-muted);
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.metric-value {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.metric-card:nth-child(1) .metric-value { color: var(--fm-accent); }
.metric-card:nth-child(2) .metric-value { color: var(--fm-blue); }
.metric-card:nth-child(3) .metric-value { color: var(--fm-green); }
.metric-card:nth-child(4) .metric-value { color: var(--fm-purple); }

.metric-card--danger::before { background: var(--fm-red); }
.metric-card--danger .metric-value { color: var(--fm-red); }
.metric-card--warning::before { background: var(--fm-accent); }
.metric-card--warning .metric-value { color: var(--fm-accent); }
.metric-card--success::before { background: var(--fm-green); }
.metric-card--success .metric-value { color: var(--fm-green); }
.metric-card--info::before { background: var(--fm-blue); }
.metric-card--info .metric-value { color: var(--fm-blue); }
.metric-card--neutral::before { background: var(--fm-text-muted); }
.metric-card--neutral .metric-value { color: var(--fm-text-primary); }

.metric-sub {
    font-size: 0.78rem;
    color: var(--fm-text-muted);
}

.metric-sub .up { color: var(--fm-green); }
.metric-sub .down { color: var(--fm-red); }
.metric-sub--extra {
    font-size: 0.78rem;
    margin-top: 0.2rem;
    opacity: 0.7;
}

:root:not([data-theme="light"]) .metric-label,
:root:not([data-theme="light"]) .metric-sub,
:root:not([data-theme="light"]) .card-body p,
:root:not([data-theme="light"]) .data-table td,
:root:not([data-theme="light"]) .detail-field .field-label,
:root:not([data-theme="light"]) .detail-subtitle {
    color: rgba(255, 255, 255, 0.82);
}

:root:not([data-theme="light"]) .section-title,
:root:not([data-theme="light"]) .detail-section-title,
:root:not([data-theme="light"]) .card-arrow {
    color: rgba(255, 255, 255, 0.62);
}

[data-theme="light"] .metric-label,
[data-theme="light"] .metric-sub,
[data-theme="light"] .card-body p,
[data-theme="light"] .data-table td,
[data-theme="light"] .detail-field .field-label,
[data-theme="light"] .detail-subtitle {
    color: #3f465b;
}

[data-theme="light"] .section-title,
[data-theme="light"] .detail-section-title,
[data-theme="light"] .card-arrow {
    color: #5d6479;
}

.dashboard-intro {
    margin-bottom: 1.5rem;
    color: var(--fm-text-secondary);
}

.dashboard-links {
    margin-bottom: 2rem;
}

/* Dashboard Grid — Main Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
    margin-top: 0;
}

.dashboard-card {
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all var(--fm-transition);
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 1.15rem;
    position: relative;
    overflow: hidden;
}

.dashboard-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transition: opacity var(--fm-transition-slow);
    pointer-events: none;
}

.dashboard-card:nth-child(1)::after { background: var(--fm-accent); }
.dashboard-card:nth-child(2)::after { background: var(--fm-blue); }
.dashboard-card:nth-child(3)::after { background: var(--fm-purple); }
.dashboard-card:nth-child(4)::after { background: var(--fm-green); }

.dashboard-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--fm-shadow-md);
    transform: translateY(-2px);
    background: var(--fm-bg-card-hover);
}

.dashboard-card:hover::after {
    opacity: 0.06;
}

.card-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--fm-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon-wrap svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-card:nth-child(1) .card-icon-wrap {
    background: var(--fm-accent-dim);
    color: var(--fm-accent);
}
.dashboard-card:nth-child(2) .card-icon-wrap {
    background: var(--fm-blue-dim);
    color: var(--fm-blue);
}
.dashboard-card:nth-child(3) .card-icon-wrap {
    background: var(--fm-purple-dim);
    color: var(--fm-purple);
}
.dashboard-card:nth-child(4) .card-icon-wrap {
    background: var(--fm-green-dim);
    color: var(--fm-green);
}

.card-body h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--fm-text-primary);
}

.card-body p {
    font-size: 0.82rem;
    color: var(--fm-text-muted);
    line-height: 1.5;
    margin: 0;
}

.card-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    opacity: 0;
    transition: all var(--fm-transition);
    color: var(--fm-text-muted);
}

.card-arrow svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.dashboard-card:hover .card-arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Section Title */
.section-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fm-text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--fm-border);
}

/* Staggered animation for dashboard items */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

.fade-up {
    opacity: 0;
    animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* ============================================
   VIEW — Placeholder (for upcoming phases)
   ============================================ */
.view-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 440px;
    margin: 4rem auto;
}

.placeholder-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: var(--fm-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
}

.placeholder-icon-wrap svg {
    width: 32px;
    height: 32px;
    stroke: var(--fm-accent);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.view-placeholder h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--fm-text-primary);
}

.view-placeholder p {
    font-size: 0.9rem;
    color: var(--fm-text-secondary);
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--fm-accent-dim);
    color: var(--fm-accent);
    border: 1px solid var(--fm-border-accent);
}

/* ============================================
   VIEW — List Pages (Kunden, Projekte, Kampagnen)
   ============================================ */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-header h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.view-header .view-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--fm-radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: all var(--fm-transition);
    border: 1px solid var(--fm-border);
    background: var(--fm-bg-card);
    color: var(--fm-text-secondary);
    text-decoration: none;
}

.btn:hover {
    background: var(--fm-bg-card-hover);
    color: var(--fm-text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-primary {
    background: var(--fm-accent);
    color: var(--fm-accent-text);
    border-color: var(--fm-accent);
}

.btn-primary:hover {
    background: var(--fm-accent-light);
    color: var(--fm-accent-text);
    border-color: var(--fm-accent-light);
    box-shadow: 0 0 20px rgba(212, 160, 83, 0.2);
}

/* Search Bar */
.search-bar {
    position: relative;
    width: 280px;
}

.search-bar input {
    width: 100%;
    padding: 0.55rem 0.9rem 0.55rem 2.4rem;
    border-radius: var(--fm-radius-sm);
    border: 1px solid var(--fm-border);
    background: var(--fm-bg-input);
    color: var(--fm-text-primary);
    font-size: 0.82rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all var(--fm-transition);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--fm-text-muted);
}

.search-bar input:focus {
    border-color: var(--fm-border-accent);
    box-shadow: 0 0 0 3px rgba(212, 160, 83, 0.08);
}

.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fm-text-muted);
    pointer-events: none;
}

.search-bar .search-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Data Table */
.data-table-wrap {
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: var(--fm-bg-raised);
    border-bottom: 1px solid var(--fm-border);
}

.data-table th {
    padding: 0.75rem 1.15rem;
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fm-text-muted);
    font-weight: 700;
}

.data-table td {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--fm-border-light);
    color: var(--fm-text-secondary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--fm-transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .cell-primary {
    color: var(--fm-text-primary);
    font-weight: 500;
}

.data-table .cell-link {
    color: var(--fm-accent);
    cursor: pointer;
    font-weight: 500;
}

.data-table .cell-link:hover {
    color: var(--fm-accent-light);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-active {
    background: var(--fm-green-dim);
    color: var(--fm-green);
}
.status-active::before { background: var(--fm-green); }

.status-pending {
    background: var(--fm-accent-dim);
    color: var(--fm-accent);
}
.status-pending::before { background: var(--fm-accent); }

.status-inactive {
    background: rgba(255, 255, 255, 0.04);
    color: var(--fm-text-muted);
}
.status-inactive::before { background: var(--fm-text-muted); }

:root:not([data-theme="light"]) .status-badge {
    border-color: rgba(255, 255, 255, 0.10);
}

[data-theme="light"] .status-badge {
    border-color: rgba(0, 0, 0, 0.08);
}

.status-success {
    background: var(--fm-green-dim);
    color: var(--fm-green);
}
.status-success::before { background: var(--fm-green); }

.status-warning {
    background: var(--fm-accent-dim);
    color: var(--fm-accent);
}
.status-warning::before { background: var(--fm-accent); }

.status-danger {
    background: var(--fm-red-dim);
    color: var(--fm-red);
}
.status-danger::before { background: var(--fm-red); }

.status-info {
    background: var(--fm-blue-dim);
    color: var(--fm-blue);
}
.status-info::before { background: var(--fm-blue); }

.status-neutral {
    background: rgba(255, 255, 255, 0.04);
    color: var(--fm-text-muted);
}
.status-neutral::before { background: var(--fm-text-muted); }

/* ============================================
   VIEW — Detail Pages
   ============================================ */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.detail-header .detail-title-group h2 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.detail-header .detail-subtitle {
    color: var(--fm-text-muted);
    font-size: 0.85rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-section {
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    padding: 1.5rem;
}

.detail-section-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fm-text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--fm-border);
}

.detail-field {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.85rem;
}

.detail-field:not(:last-child) {
    border-bottom: 1px solid var(--fm-border-light);
}

.detail-field .field-label {
    color: var(--fm-text-muted);
    font-weight: 500;
}

.detail-field .field-value {
    color: var(--fm-text-primary);
    font-weight: 500;
    text-align: right;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5px;
    bottom: 0;
    width: 1px;
    background: var(--fm-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
    padding-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--fm-accent);
    background: var(--fm-bg-base);
}

.timeline-item .timeline-date {
    font-size: 0.72rem;
    color: var(--fm-text-muted);
    margin-bottom: 0.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-item .timeline-content {
    font-size: 0.85rem;
    color: var(--fm-text-secondary);
    line-height: 1.5;
}

/* Full width detail section */
.detail-full-width {
    grid-column: 1 / -1;
}

/* ============================================
   VIEW — Kampagnen / Form
   ============================================ */
.form-card {
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    padding: 2rem;
    max-width: 640px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fm-text-muted);
    margin-bottom: 0.45rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--fm-radius-sm);
    border: 1px solid var(--fm-border);
    background: var(--fm-bg-input);
    color: var(--fm-text-primary);
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all var(--fm-transition);
    outline: none;
}

.dropbox-picker {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dropbox-picker__field {
    flex: 1 1 320px;
    min-width: 0;
}

.dropbox-picker__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dropbox-browser {
    width: min(900px, calc(100vw - 2rem));
    height: min(860px, 95vh);
    max-height: 95vh;
    margin: auto;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-lg);
    padding: 0;
    background: var(--fm-bg-card);
    color: var(--fm-text-primary);
    box-shadow: var(--fm-shadow-lg);
    overflow: hidden;
}

.dropbox-browser::backdrop {
    background: rgba(0, 0, 0, 0.75);
}

.dropbox-browser__shell {
    height: 100%;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

.dropbox-browser__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dropbox-browser__suppliers {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.dropbox-browser__supplier {
    border: 1px solid var(--fm-border);
    background: var(--fm-bg-input);
    color: var(--fm-text-primary);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--fm-transition);
}

.dropbox-browser__supplier:hover {
    border-color: var(--fm-border-accent);
}

.dropbox-browser__supplier.is-active {
    background: var(--fm-accent-dim);
    border-color: var(--fm-border-accent);
    color: var(--fm-accent-light);
}

.dropbox-browser__searchbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.dropbox-browser__search {
    flex: 1 1 320px;
    min-width: 0;
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--fm-radius-sm);
    border: 1px solid var(--fm-border);
    background: var(--fm-bg-input);
    color: var(--fm-text-primary);
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all var(--fm-transition);
    outline: none;
}

.dropbox-browser__search::placeholder {
    color: var(--fm-text-muted);
}

.dropbox-browser__search:focus {
    border-color: var(--fm-border-accent);
    box-shadow: 0 0 0 3px rgba(212, 160, 83, 0.08);
}

.dropbox-browser__title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.dropbox-browser__path {
    margin-top: 0.25rem;
    color: var(--fm-text-muted);
    font-size: 0.82rem;
}

.dropbox-browser__crumbs {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.dropbox-browser__crumb {
    background: none;
    border: 0;
    color: var(--fm-accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.dropbox-browser__crumb-sep {
    color: var(--fm-text-muted);
}

.dropbox-browser__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    background: var(--fm-bg-base);
}

.dropbox-browser__row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: 0;
    border-bottom: 1px solid var(--fm-border-light);
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    padding: 0.8rem 0.95rem;
    font: inherit;
}

.dropbox-browser__row--image {
    justify-content: flex-start;
    align-items: center;
}

.dropbox-browser__thumb {
    flex: 0 0 4.5rem;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--fm-border-light);
}

.dropbox-browser__thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.dropbox-browser__entry {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dropbox-browser__row:hover {
    background: var(--fm-bg-card-hover);
}

.dropbox-browser__row.is-selected {
    border-color: var(--fm-border-accent);
    background: rgba(212, 160, 83, 0.12);
}

.dropbox-browser__row--folder {
    color: var(--fm-accent-light);
}

.dropbox-browser__row--file {
    cursor: default;
}

.dropbox-browser__row--file.is-selected {
    background: rgba(212, 160, 83, 0.08);
}

.dropbox-browser__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropbox-browser__meta {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.dropbox-browser__empty {
    padding: 1.2rem;
    color: var(--fm-text-muted);
    text-align: center;
}

.dropbox-browser__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;

    &.cluster--between { justify-content: space-between; }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--fm-border-accent);
    box-shadow: 0 0 0 3px rgba(212, 160, 83, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--fm-border);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--fm-text-muted);
    fill: none;
    stroke-width: 1.2;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--fm-text-secondary);
}

.empty-state p {
    font-size: 0.82rem;
    color: var(--fm-text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .app-content {
        padding: 1.25rem;
    }
    .app-content::before {
        left: 0;
    }
    .metrics-row {
        grid-template-columns: 1fr 1fr;
    }
    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-bar {
        width: 100%;
    }
}

/* ============================================================
 * Phase 4 — CSS View Transitions (Multi-Page-Variante, opt-in
 * via <meta name="view-transition" content="same-origin"> im
 * layout.php). Browser-Support: Chrome/Edge 126+, Safari 18+,
 * Firefox 134+ (cross-document). Fallback in älteren Browsern:
 * klassisches Page-Reload ohne Fehler.
 * ============================================================ */

@view-transition {
    navigation: auto;
}

/* Nur der Content-Bereich animiert; Topbar/Sidebar bleiben als
 * "shared elements" stehen (Default-Verhalten ohne named transition). */
.app-content {
    view-transition-name: main-content;
}

::view-transition-old(main-content),
::view-transition-new(main-content) {
    animation-duration: 200ms;
}

/* Respektiere reduzierte Bewegung (System-Setting). */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(main-content),
    ::view-transition-new(main-content) {
        animation-duration: 0s;
    }
}

/* ============================================================
 * Phase 4 — Task-Suche Loading-Indikator
 * ============================================================ */

.task-search-pulse {
    color: #f3c481;
    animation: task-pulse 1.4s ease-in-out infinite;
}

@keyframes task-pulse {
    0%, 100% { opacity: 0.65; }
    50%      { opacity: 1; }
}

.task-search-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(212, 160, 83, 0.25);
    border-top-color: #D4A053;
    border-radius: 50%;
    animation: task-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes task-spin {
    to { transform: rotate(360deg); }
}

.task-search-dots::after {
    content: '';
    display: inline-block;
    width: 1.5em;
    text-align: left;
    animation: task-dots 1.2s steps(4, end) infinite;
}

@keyframes task-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

@media (prefers-reduced-motion: reduce) {
    .task-search-pulse,
    .task-search-spinner {
        animation: none;
    }
    .task-search-dots::after {
        content: '…';
        animation: none;
    }
}

/* Verrechnungs-Picker Dropdown — Default hidden (vor petite-vue mount).
   .is-open wird per :class durch open=true gesetzt. */
.fmd-picker-dropdown {
    display: none;
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--color-card-bg, #1f1f1f);
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.15));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    top: 100%;
    margin-top: 0.25rem;
}
.fmd-picker-dropdown.is-open {
    display: block;
}
.fmd-picker-dropdown.is-up {
    top: auto;
    bottom: calc(100% - 1.5rem);
    margin-top: 0;
    margin-bottom: 0.25rem;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

/* ============================================================
 * Update Seite
 * ============================================================ */
.js-status-cell {
    white-space: nowrap;
}

/* ============================================================
 * KI-Generierung (Phase 15)
 * ============================================================ */
@keyframes fm-ai-spin {
    to { transform: rotate(360deg); }
}

/* Gemeinsame Basis fuer pending + generating: Card geblurred + nicht klickbar */
.fm-ai-pending,
.fm-ai-generating {
    position: relative;
    pointer-events: none;
    user-select: none;
}
.fm-ai-pending > *,
.fm-ai-generating > * {
    filter: blur(2px) saturate(0.6);
    opacity: 0.55;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Pending: dezenter Hinweis 'wartet auf KI', kein Spinner */
.fm-ai-pending::after {
    content: 'wartet auf KI …';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.1);
    color: var(--fm-text-primary, #fff);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Aktive Generierung: zentrierter Spinner + Hinweistext */
.fm-ai-generating::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.4rem;
    height: 2.4rem;
    margin: -1.7rem 0 0 -1.2rem;
    border: 3px solid rgba(212, 160, 83, 0.25);
    border-top-color: var(--color-accent, #D4A053);
    border-radius: 50%;
    animation: fm-ai-spin 0.8s linear infinite;
    z-index: 2;
}
.fm-ai-generating::after {
    content: 'KI generiert …';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 0);
    margin-top: 1.2rem;
    color: var(--fm-text-primary, #fff);
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 2;
}

/* Modal (Quellen + andere KI-Dialoge) ===================== */
.fm-modal {
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.15));
    border-radius: 12px;
    background: var(--color-surface, #1a1a1f);
    color: var(--fm-text-primary, #fff);
    padding: 0;
    width: min(640px, calc(100vw - 2rem));
    max-height: 85vh;
    margin: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.fm-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}
.fm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}
.fm-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.fm-modal__close {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0.2rem 0.4rem;
}
.fm-modal__close:hover { opacity: 1; }
.fm-modal__body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    max-height: calc(85vh - 4rem);
    font-size: 0.9rem;
}
.fm-modal__section {
    margin-bottom: 1rem;
}
.fm-modal__section h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin: 0 0 0.4rem;
    font-weight: 600;
}
.fm-modal__kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 0.8rem;
    font-size: 0.85rem;
}
.fm-modal__kv dt { opacity: 0.65; }
.fm-modal__kv dd { margin: 0; word-break: break-word; }
.fm-modal__subhead {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.55;
}
.fm-modal__list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
}
.fm-modal__list li { margin-bottom: 0.15rem; }

.fm-ai-cost-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(212, 160, 83, 0.1);
    border: 1px solid rgba(212, 160, 83, 0.3);
    color: var(--fm-text-primary, #fff);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.fm-ai-sources-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.15));
    color: inherit;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0.7;
}
.fm-ai-sources-btn:hover { opacity: 1; }

/* ============================================
   DESIGN SYSTEM — Components (v1.3)
   Reihenfolge: position/display -> size -> font -> box -> rest
   ============================================ */

/* ---- Card ---- */
.card {
    display: block;
    padding: 1.15rem 1.25rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    box-shadow: var(--fm-shadow-sm);

    & > :last-child { margin-bottom: 0; }

    &.card--compact { padding: 0.75rem 0.9rem; }
    &.card--flat {
        background: transparent;
        border: 1px solid var(--fm-border-light);
        box-shadow: none;
    }
    &.card--prominent {
        border-color: var(--fm-border-accent);
        box-shadow: var(--fm-shadow-md);
    }
    &.card--danger {
        border-color: rgba(220, 50, 70, 0.35);
        background: rgba(220, 50, 70, 0.06);
    }
    &.card--warning {
        border-color: rgba(220, 160, 50, 0.35);
        background: rgba(220, 160, 50, 0.06);
    }
    &.card--success {
        border-color: rgba(80, 200, 120, 0.35);
        background: rgba(80, 200, 120, 0.06);
    }
    &.card--info {
        border-color: rgba(80, 150, 220, 0.35);
        background: rgba(80, 150, 220, 0.06);
    }
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--fm-border-light);

    & > h1, & > h2, & > h3, & > h4 { margin: 0; }
}
.card__title {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fm-text-primary);
    margin: 0;
}
.card__subtitle {
    font-size: 0.82rem;
    color: var(--fm-text-secondary);
    margin: 0.15rem 0 0;
}
.card__body {
    display: block;

    & > :last-child { margin-bottom: 0; }
}
.card__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--fm-border-light);
}

/* ---- Button-Modifier ergänzen die Base auf <button> ---- */
.btn--primary {
    color: var(--fm-accent-text);
    background: var(--fm-accent);
    border-color: var(--fm-accent);
    font-weight: 600;

    &:hover:not(:disabled) {
        background: var(--fm-accent-light);
        border-color: var(--fm-accent-light);
        color: var(--fm-accent-text);
    }
}
.btn--secondary {
    /* Default-Style von <button> ist bereits secondary. Alias zur
       expliziten Kennzeichnung. */
    background: var(--fm-bg-card);
    border-color: var(--fm-border);
    color: var(--fm-text-primary);
}
.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--fm-text-secondary);

    &:hover:not(:disabled) {
        background: var(--fm-bg-card-hover);
        color: var(--fm-text-primary);
        border-color: transparent;
    }
}
.btn--success {
    color: var(--fm-pill-success-text);
    background: var(--fm-pill-success-bg);
    border-color: var(--fm-pill-success-border);

    &:hover:not(:disabled) {
        background: var(--fm-pill-success-border);
        color: #0a3a1e;
    }
}
.btn--danger {
    color: var(--fm-pill-danger-text);
    background: var(--fm-pill-danger-bg);
    border-color: var(--fm-pill-danger-border);

    &:hover:not(:disabled) {
        background: var(--fm-pill-danger-border);
        color: #3d0810;
    }
}
.btn--warning {
    color: var(--fm-pill-warning-text);
    background: var(--fm-pill-warning-bg);
    border-color: var(--fm-pill-warning-border);

    &:hover:not(:disabled) {
        background: var(--fm-pill-warning-border);
        color: #3d2508;
    }
}
.btn--info {
    color: var(--fm-pill-info-text);
    background: var(--fm-pill-info-bg);
    border-color: var(--fm-pill-info-border);

    &:hover:not(:disabled) {
        background: var(--fm-pill-info-border);
        color: #0a2340;
    }
}
.btn--link {
    min-height: 0;
    padding: 0;
    color: var(--fm-accent);
    background: transparent;
    border: 0;

    &:hover:not(:disabled) {
        background: transparent;
        color: var(--fm-accent-light);
        text-decoration: underline;
    }
}
.btn--sm {
    min-height: 1.75rem;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    gap: 0.3rem;
}
.btn--lg {
    min-height: 2.75rem;
    font-size: 1rem;
    padding: 0.7rem 1.4rem;
    gap: 0.5rem;
}
.btn--block {
    display: flex;
    width: 100%;
}
.btn--icon {
    /* Runder Icon-Only-Button */
    width: 2.2rem;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border-radius: 50%;

    &.btn--sm { width: 1.75rem; min-width: 1.75rem; height: 1.75rem; }
    &.btn--lg { width: 2.75rem; min-width: 2.75rem; height: 2.75rem; }
}

/* Button-Gruppe: mehrere Buttons zusammen als eine Kontrolle */
.btn-group {
    display: inline-flex;
    align-items: stretch;

    & > button, & > .btn {
        border-radius: 0;
        margin: 0;

        &:not(:first-child) { margin-left: -1px; }
        &:first-child { border-radius: var(--fm-radius-sm) 0 0 var(--fm-radius-sm); }
        &:last-child { border-radius: 0 var(--fm-radius-sm) var(--fm-radius-sm) 0; }
        &:only-child { border-radius: var(--fm-radius-sm); }
    }
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--fm-pill-neutral-text);
    padding: 0.2rem 0.6rem;
    background: var(--fm-pill-neutral-bg);
    border: 1px solid var(--fm-pill-neutral-border);
    border-radius: 99px;
    white-space: nowrap;

    &.badge--success {
        color: var(--fm-pill-success-text);
        background: var(--fm-pill-success-bg);
        border-color: var(--fm-pill-success-border);
    }
    &.badge--danger {
        color: var(--fm-pill-danger-text);
        background: var(--fm-pill-danger-bg);
        border-color: var(--fm-pill-danger-border);
    }
    &.badge--warning {
        color: var(--fm-pill-warning-text);
        background: var(--fm-pill-warning-bg);
        border-color: var(--fm-pill-warning-border);
    }
    &.badge--info {
        color: var(--fm-pill-info-text);
        background: var(--fm-pill-info-bg);
        border-color: var(--fm-pill-info-border);
    }
    &.badge--accent {
        color: var(--fm-accent-text);
        background: var(--fm-accent);
        border-color: var(--fm-accent);
    }
    &.badge--outline {
        background: transparent;
    }
    &.badge--sm {
        font-size: 0.68rem;
        padding: 0.1rem 0.45rem;
    }
    &.badge--lg {
        font-size: 0.85rem;
        padding: 0.3rem 0.8rem;
    }
    &.badge--dot::before {
        content: '';
        display: inline-block;
        width: 6px;
        height: 6px;
        background: currentColor;
        border-radius: 50%;
    }
}

/* ---- Field (Label + Control + Hint) ---- */
.field {
    display: block;
    margin-bottom: 1rem;

    & > label { display: block; }

    & > input, & > select, & > textarea { width: 100%; }

    &.field--inline {
        display: grid;
        grid-template-columns: minmax(9rem, auto) 1fr;
        align-items: center;
        gap: 0.75rem;

        & > label { margin-bottom: 0; }
    }
    /* Checkbox links, Label rechts — Label bleibt klickbar, Box behaelt ihre Groesse. */
    &.field--check {
        display: flex;
        align-items: center;
        gap: 0.55rem;

        & > input[type="checkbox"] { width: auto; flex: none; cursor: pointer; }
        & > label { margin-bottom: 0; cursor: pointer; user-select: none; }
    }
    &.field--error {
        & > input, & > select, & > textarea {
            border-color: var(--fm-red);
            box-shadow: 0 0 0 3px var(--fm-red-dim);
        }
        & > .field-hint { color: var(--fm-red); }
    }
}
.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--fm-text-secondary);
    margin-top: 0.3rem;
}
.field-error {
    display: block;
    font-size: 0.78rem;
    color: var(--fm-red);
    margin-top: 0.3rem;
}

/* Fieldset-Grid: mehrspaltige Felder */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.9rem 1.15rem;

    & > .field { margin-bottom: 0; }
}

/* ---- Links ---- */
.link {
    color: var(--fm-accent);
    text-decoration: none;

    &:hover { color: var(--fm-accent-light); text-decoration: underline; }
}
.link--muted {
    color: var(--fm-text-secondary);

    &:hover { color: var(--fm-text-primary); text-decoration: underline; }
}
.link--danger {
    color: var(--fm-red);

    &:hover { color: var(--fm-red); text-decoration: underline; }
}
.link--plain {
    color: inherit;

    &:hover { color: inherit; text-decoration: underline; }
}

/* ---- Layout-Helper ---- */
.stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;

    &.stack--sm { gap: 0.4rem; }
    &.stack--lg { gap: 1.25rem; }
    &.stack--xl { gap: 2rem; }
}
.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;

    &.cluster--sm { gap: 0.3rem; }
    &.cluster--lg { gap: 1rem; }
    &.cluster--between { justify-content: space-between; }
    &.cluster--end { justify-content: flex-end; }
    &.cluster--start { justify-content: flex-start; }
    &.cluster--top { align-items: flex-start; }
    &.cluster--baseline { align-items: baseline; }
    &.cluster--nowrap { flex-wrap: nowrap; }
}
.actionbar {
    /* Sticky-Footer-Style Aktionsleiste (Formulare, Freigabe-Ansicht) */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.9rem 1.15rem;
    background: var(--fm-bg-raised);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-md);
    box-shadow: var(--fm-shadow-md);

    &.actionbar--between { justify-content: space-between; }
    &.actionbar--start { justify-content: flex-start; }
    &.actionbar--floating {
        position: sticky;
        bottom: 1rem;
        z-index: 20;
    }
}
.section-divider {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fm-border-light);
}
.page-section {
    display: block;
    padding: 0 0 1.5rem;

    & + .page-section {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--fm-border-light);
    }
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;

    & h1, & h2 { margin: 0; }
}

/* ---- Text-/Utility-Helper (klein halten) ---- */
.text-muted { color: var(--fm-text-secondary); }
.text-subtle { color: var(--fm-text-muted); }
.text-primary { color: var(--fm-text-primary); }
.text-accent { color: var(--fm-accent); }
.text-success { color: var(--fm-green); }
.text-danger { color: var(--fm-red); }
.text-warning { color: var(--fm-accent); }
.text-info { color: var(--fm-blue); }

.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-lg { font-size: 1.05rem; }
.text-bold { font-weight: 600; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.04em; }
.text-nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-break { word-break: break-word; overflow-wrap: anywhere; }
.text-truncate {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.grow { flex: 1 1 auto; }
.shrink-0 { flex-shrink: 0; }
.full-width { width: 100%; }

.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.4rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1.25rem; }
.gap-xl { gap: 2rem; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }

/* Grid-Helper */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

/* ---- Alert / Notice ---- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--fm-pill-info-bg);
    color: var(--fm-pill-info-text);
    border: 1px solid var(--fm-pill-info-border);
    border-radius: var(--fm-radius-sm);

    &.notice--success {
        background: var(--fm-pill-success-bg);
        color: var(--fm-pill-success-text);
        border-color: var(--fm-pill-success-border);
    }
    &.notice--danger {
        background: var(--fm-pill-danger-bg);
        color: var(--fm-pill-danger-text);
        border-color: var(--fm-pill-danger-border);
    }
    &.notice--warning {
        background: var(--fm-pill-warning-bg);
        color: var(--fm-pill-warning-text);
        border-color: var(--fm-pill-warning-border);
    }
}

/* ============================================
   LOGIN / STANDALONE PAGES
   ============================================ */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    height: auto;
    overflow: auto;
    background: var(--fm-bg-deepest);
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 2.5rem;
    box-shadow: var(--fm-shadow-lg);

    & .btn { margin-top: 0.5rem; }
}
.login-brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.login-brand__mark {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--fm-accent);
}
.login-brand__text {
    font-weight: 500;
    opacity: 0.9;
}
.login-brand__tag {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    margin-left: auto;
    opacity: 0.5;
}
.login-title {
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 1.4rem;
    margin: 0.75rem 0 1.5rem;
}

/* ============================================
   SM PLAN DETAIL (Redaktionsplan-Editor)
   ============================================ */

.sm-plan-page {
    display: block;
    max-width: 1400px;
    padding: 2rem;
}

.sm-plan-back {
    display: block;
    font-size: 0.85rem;
    color: inherit;
    margin: 0 0 0.2rem;
    opacity: 0.6;
    text-decoration: none;

    &:hover { color: inherit; opacity: 0.9; }
}

.sm-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}
.sm-plan-header__title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;

    & h1 {
        font-family: 'Bricolage Grotesque', system-ui, sans-serif;
        font-weight: 600;
        margin: 0;
    }
    & h1 .sm-plan-header__sub {
        font-size: 0.7em;
        opacity: 0.55;
    }
}
.sm-plan-header__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.sm-plan-header__action-wide {
    min-width: 14rem;
}

.sm-plan-back-btn {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    color: inherit;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    text-decoration: none;
    opacity: 0.7;

    &:hover { color: inherit; opacity: 1; background: var(--fm-bg-card-hover); }
}

/* Item-Card */
.sm-item {
    display: block;
    padding: 1rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: 10px;
}
.sm-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}
.sm-item__head-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.sm-item__num {
    font-size: 0.85rem;
    opacity: 0.55;
}
.sm-item__title {
    font-weight: 600;
}
.sm-item__head-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Editier-Felder (2-Spalten-Grid; disabled = weniger deckend) */
.sm-item__fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 0.8rem;

    @media (max-width: 720px) {
        grid-template-columns: 1fr;
    }

    &.is-locked { opacity: 0.55; }
}
.sm-item__field {
    display: block;

    &.sm-item__field--full { grid-column: span 2; }
    & label {
        display: block;
        font-size: 0.74rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--fm-text-secondary);
        margin-bottom: 0.25rem;
        opacity: 0.6;
    }
    & .sm-item__hint {
        text-transform: none;
        letter-spacing: 0;
        font-weight: 400;
        opacity: 0.7;
        margin-left: 0.35rem;
    }
    & input,
    & select,
    & textarea {
        width: 100%;
        font: inherit;
        font-size: 0.88rem;
        color: inherit;
        padding: 0.45rem 0.6rem;
        background: rgba(255,255,255,0.05);
        border: 1px solid var(--fm-border);
        border-radius: 6px;
    }
    & textarea {
        font-family: inherit;
        resize: vertical;
    }
}
[data-theme="light"] .sm-item__field input,
[data-theme="light"] .sm-item__field select,
[data-theme="light"] .sm-item__field textarea {
    background: var(--fm-bg-input);
}

.sm-item__fotos-label-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.sm-item__fotos-label {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--fm-text-secondary);
    margin: 0;
    opacity: 0.6;
}
.sm-item__save-state {
    font-size: 0.78rem;
    opacity: 0.6;
}
.sm-item__fotos-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 1.5rem;
    margin-bottom: 0.6rem;
}
.sm-foto {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
    overflow: hidden;
    border: 1px solid var(--fm-border);
    border-radius: 6px;

    & img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: zoom-in;
    }
}
.sm-foto__del {
    position: absolute;
    top: 2px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.85rem;
    line-height: 1;
    color: #fff;
    padding: 0;
    background: rgba(0,0,0,0.6);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.sm-item__fotos-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.sm-item__fotos-hint {
    margin: 0.3rem 0 0;
    font-size: 0.74rem;
    opacity: 0.45;
}

/* Feedback-Verlauf */
.sm-feedback {
    margin-top: 1.5rem;

    & h2 {
        font-family: 'Bricolage Grotesque', system-ui, sans-serif;
        font-size: 1.05rem;
        font-weight: 600;
        margin: 0 0 0.8rem;
    }
    & h2 small {
        font-size: 0.78rem;
        font-weight: 400;
        opacity: 0.55;
        color: inherit;
    }
    & p.sm-feedback__empty {
        margin: 0;
        font-size: 0.9rem;
        opacity: 0.6;
    }
}

.sm-feedback__entry {
    margin: 0 0 0.7rem;
    background: rgba(0,0,0,0.06);
    border: 1px solid var(--fm-border-light);
    border-radius: 8px;

    & > summary {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-wrap: wrap;
        padding: 0.6rem 0.85rem;
        list-style: none;
        cursor: pointer;

        &::-webkit-details-marker { display: none; }
    }
}
.sm-feedback__body {
    display: grid;
    gap: 0.6rem;
    padding: 0 0.85rem 0.85rem;
}
.sm-feedback__meta {
    font-size: 0.78rem;
    opacity: 0.55;
}
.sm-feedback__note {
    font-size: 0.78rem;
    opacity: 0.7;
}
.sm-feedback__snap {
    padding: 0.6rem 0.75rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border-light);
    border-radius: 6px;
    font-size: 0.85rem;
}
.sm-feedback__snap-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.3rem;

    & strong { font-size: 0.82rem; }
}
.sm-feedback__snap-status {
    font-size: 0.74rem;
    opacity: 0.55;
}
.sm-feedback__snap-thema { opacity: 0.85; }
.sm-feedback__snap-teaser { margin-top: 0.2rem; opacity: 0.75; }
.sm-feedback__snap-label {
    display: inline;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.6;
}
.sm-feedback__aw {
    margin-top: 0.35rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
    color: var(--fm-pill-warning-text);
    background: var(--fm-pill-warning-bg);
    border-left: 3px solid var(--fm-pill-warning-border);
    border-radius: 4px;

    & strong {
        display: block;
        font-size: 0.74rem;
        margin-bottom: 0.15rem;
        opacity: 0.7;
    }
}

/* Dropbox-Selection-Panel (im Import-Dialog) */
.sm-dropbox-selection {
    margin-top: 0.25rem;
    padding: 0.9rem;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--fm-border);
    border-radius: 10px;
}
.sm-dropbox-selection__row {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    flex-wrap: wrap;
}
.sm-dropbox-selection__preview {
    width: 8rem;
    height: 8rem;
    object-fit: cover;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--fm-border);
    border-radius: 8px;
}
.sm-dropbox-selection__body {
    flex: 1 1 auto;
    min-width: 14rem;
}
.sm-dropbox-selection__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
    opacity: 0.6;
}
.sm-dropbox-selection__title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.sm-dropbox-selection__meta,
.sm-dropbox-selection__note {
    font-size: 0.84rem;
    opacity: 0.7;
}
.sm-dropbox-selection__note {
    margin: 0.5rem 0 0;
    opacity: 0.75;
}
.sm-dropbox-selection__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

/* Link-Dialog (Freigabelink kopieren) */
.sm-link-dialog {
    max-width: 48rem;
    width: min(48rem, calc(100vw - 2rem));
    padding: 0;
    background: transparent;
    border: 0;
}
.sm-link-dialog__inner {
    padding: 1.5rem;
    color: var(--fm-text-primary);
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: 12px;

    & h2 { margin: 0 0 1rem; font-size: 1.2rem; }
    & p { margin: 0 0 1rem; opacity: 0.7; }
}
.sm-link-dialog__row {
    display: flex;
    gap: 0.5rem;

    & input {
        flex: 1 1 auto;
        font-family: ui-monospace, 'SF Mono', Menlo, monospace;
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
        background: rgba(255,255,255,0.05);
        border: 1px solid var(--fm-border);
        border-radius: 6px;
        color: inherit;
    }
}
.sm-link-dialog__foot {
    text-align: right;
    margin-top: 1.2rem;
}

/* Foto-Lightbox — teilt sich Klasse mit Freigabe-Version */
#sm-foto-lightbox {
    display: grid;
    place-items: center;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    overflow: visible;

    &:not([open]) { display: none; }
    &::backdrop {
        background: rgba(0,0,0,0);
        transition: background 260ms cubic-bezier(.2,.8,.2,1);
    }
    &[data-state="open"]::backdrop,
    &[data-state="opening"]::backdrop { background: rgba(0,0,0,0.85); }

    & .lb-panel {
        position: relative;
        opacity: 0;
        transform: translateY(16px) scale(0.97);
        transition: opacity 260ms cubic-bezier(.2,.8,.2,1), transform 260ms cubic-bezier(.2,.8,.2,1);
    }
    &[data-state="open"] .lb-panel {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    & .lb-img {
        display: block;
        max-width: 90vw;
        max-height: 90vh;
        border-radius: 8px;
        box-shadow: 0 24px 60px rgba(0,0,0,0.4);
    }
    & .lb-close {
        position: absolute;
        top: -2.2rem;
        right: -0.2rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        font-size: 1.2rem;
        line-height: 1;
        color: #fff;
        background: rgba(255,255,255,0.15);
        border: 0;
        border-radius: 50%;
        cursor: pointer;

        &:hover { background: rgba(255,255,255,0.3); }
    }
}

/* ============================================
   ZUSATZINFOS — Datei-Ablage pro Kunde
   ============================================ */

.zusatzinfos-card {
    display: block;
    margin-bottom: 1.5rem;

    & > h2 {
        font-family: 'Bricolage Grotesque', system-ui, sans-serif;
        font-size: 1rem;
        margin: 0 0 1rem;
    }
}

.dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 8rem;
    padding: 1.25rem;
    color: var(--fm-text-secondary);
    text-align: center;
    background: var(--fm-bg-input);
    border: 2px dashed var(--fm-border);
    border-radius: var(--fm-radius-md);
    cursor: pointer;
    transition: border-color var(--fm-transition), background var(--fm-transition), color var(--fm-transition);

    &:hover {
        color: var(--fm-text-primary);
        background: var(--fm-bg-card-hover);
        border-color: var(--fm-border-accent);
    }
    &.is-dragover {
        color: var(--fm-accent);
        background: var(--fm-accent-dim);
        border-color: var(--fm-accent);
    }
    &.is-uploading {
        opacity: 0.7;
        cursor: progress;
    }

    & svg {
        width: 32px;
        height: 32px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.6;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
}
.dropzone__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fm-text-primary);
}
.dropzone__hint {
    font-size: 0.78rem;
    color: var(--fm-text-secondary);
}
.dropzone__error {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--fm-red);
}

.zusatzinfos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;

    &:empty { display: none; }
}

.zusatzinfo {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem;
    background: var(--fm-bg-card);
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius-sm);
    transition: border-color var(--fm-transition), background var(--fm-transition);

    &:hover {
        background: var(--fm-bg-card-hover);
        border-color: var(--fm-border-accent);
    }
}

.zusatzinfo__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--fm-bg-input);
    border: 1px solid var(--fm-border-light);
    border-radius: var(--fm-radius-sm);
    cursor: pointer;
    overflow: hidden;

    & img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    & svg {
        width: 40%;
        height: 40%;
        stroke: var(--fm-text-secondary);
        fill: none;
        stroke-width: 1.6;
        stroke-linecap: round;
        stroke-linejoin: round;
        opacity: 0.7;
    }
}

.zusatzinfo__type {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    padding: 0.1rem 0.35rem;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 3px;
    pointer-events: none;
}

.zusatzinfo__name {
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--fm-text-primary);
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.zusatzinfo__meta {
    font-size: 0.7rem;
    color: var(--fm-text-secondary);
}
.zusatzinfo__del {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.9rem;
    line-height: 1;
    color: #fff;
    padding: 0;
    background: rgba(0, 0, 0, 0.55);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--fm-transition), background var(--fm-transition);

    &:hover { background: var(--fm-red); }
}
.zusatzinfo:hover .zusatzinfo__del { opacity: 1; }
.zusatzinfo__link {
    color: inherit;
    text-decoration: none;

    &:hover { color: inherit; text-decoration: none; }
}

/* Lightbox teilt sich Struktur mit #sm-foto-lightbox */
#kunden-foto-lightbox {
    display: grid;
    place-items: center;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    overflow: visible;

    &:not([open]) { display: none; }
    &::backdrop {
        background: rgba(0, 0, 0, 0);
        transition: background 260ms cubic-bezier(.2,.8,.2,1);
    }
    &[data-state="open"]::backdrop,
    &[data-state="opening"]::backdrop { background: rgba(0, 0, 0, 0.85); }

    & .lb-panel {
        position: relative;
        opacity: 0;
        transform: translateY(16px) scale(0.97);
        transition: opacity 260ms cubic-bezier(.2,.8,.2,1), transform 260ms cubic-bezier(.2,.8,.2,1);
    }
    &[data-state="open"] .lb-panel {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    & .lb-img {
        display: block;
        max-width: 90vw;
        max-height: 90vh;
        border-radius: 8px;
        box-shadow: 0 24px 60px rgba(0,0,0,0.4);
    }
    & .lb-close {
        position: absolute;
        top: -2.2rem;
        right: -0.2rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        font-size: 1.2rem;
        line-height: 1;
        color: #fff;
        background: rgba(255, 255, 255, 0.15);
        border: 0;
        border-radius: 50%;
        cursor: pointer;

        &:hover { background: rgba(255, 255, 255, 0.3); }
    }
}
