/*
 * Copyright (c) 2026–2026 Ing. Wolfgang Mlineritsch
 */
/* AVA-Bau — Basis-Stylesheet */

/* ---------- Themes ---------- */
:root, body.theme-light {
    --bg:           #f6f7f9;
    --bg-card:      #ffffff;
    --bg-side:      #0f172a;        /* dunkler für besseren Kontrast zu fg-side */
    --bg-side-hov:  #1e293b;
    --bg-side-act:  #2563eb;
    --fg:           #0f172a;        /* fast schwarz — WCAG AAA auf weiß */
    --fg-muted:     #334155;        /* slate-700 statt -500 — WCAG AA+ */
    --fg-side:      #f1f5f9;        /* heller auf dunklem Sidebar-Bg (kontrastreicher) */
    --fg-side-act:  #ffffff;
    --border:       #cbd5e1;        /* etwas kräftiger sichtbar */
    --border-soft:  #e2e8f0;
    --border-strong:#94a3b8;        /* kontrastreich — Card-Abgrenzung */
    --primary:      #1d4ed8;        /* primary etwas dunkler — bessere Lesbarkeit */
    --primary-hov:  #1e3a8a;
    --danger:       #b91c1c;        /* dunkler — besser auf hell */
    --success:      #047857;
    --warn:         #b45309;
    --shadow-sm:    0 1px 2px rgba(0,0,0,.05);
    --shadow:       0 4px 12px rgba(0,0,0,.08);
    --radius:       8px;
}
body.theme-dark {
    --bg:           #0f172a;
    --bg-card:      #1e293b;
    --bg-side:      #020617;
    --bg-side-hov:  #1e293b;
    --bg-side-act:  #2563eb;
    --fg:           #f8fafc;        /* fast weiß — maximaler Kontrast */
    --fg-muted:     #cbd5e1;        /* deutlich heller statt slate-400 */
    --fg-side:      #f1f5f9;
    --fg-side-act:  #ffffff;
    --border:       #475569;        /* sichtbarer */
    --border-soft:  #334155;
    --border-strong:#64748b;        /* kontrastreich — Card-Abgrenzung */
    --primary:      #60a5fa;
    --primary-hov:  #93c5fd;
    --danger:       #f87171;
    --success:      #34d399;
    --warn:         #fbbf24;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--fg);
    background: var(--bg);
}
/* Globale Schriftart-Vereinheitlichung — alles erbt die body-Font.
   Form-Controls, Buttons, Code-/Pre-Blöcke und Drag&Drop-Filenamen
   verwenden sonst Browser-Defaults (Arial, Times, monospace). */
input, select, textarea, button, code, kbd, samp, pre,
.dropzone, .dropzone * {
    font-family: inherit;
}

/* Beschäftigungs-Cursor während Navigation/AJAX */
body.is-loading,
body.is-loading * { cursor: progress !important; }

/* ---------- Layout ---------- */
html, body { height: 100%; }
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;     /* outer scroll suppressen — Sidebar + Main scrollen jeweils selbst */
}
body.no-sidebar .app-main { width: 100%; padding: 0; }
body.no-sidebar .app-sidebar { display: none; }

/* Sidebar ein-/ausklappen (Benutzer-Toggle, Variante A) — Zustand in localStorage.
   .app-main ist flex:1 → füllt automatisch die Breite, wenn die Sidebar weg ist. */
.app-sidebar .brand { position: relative; }
.sidebar-collapse-btn {
    position: absolute; top: 12px; right: 8px;
    background: transparent; border: 0; color: var(--fg-side);
    font-size: 18px; line-height: 1; cursor: pointer; opacity: .6;
    padding: 3px 7px; border-radius: 6px;
}
.sidebar-collapse-btn:hover { opacity: 1; background: rgba(255,255,255,.10); }
body.sidebar-collapsed .app-sidebar { display: none; }
.sidebar-expand-btn {
    display: none;
    position: fixed; top: 9px; left: 9px; z-index: 300;
    background: var(--bg-side); color: var(--fg-side);
    border: 1px solid rgba(0,0,0,.2); border-radius: 8px;
    font-size: 17px; line-height: 1; cursor: pointer;
    padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sidebar-expand-btn:hover { filter: brightness(1.15); }
body.sidebar-collapsed .sidebar-expand-btn { display: block; }
/* eingeklappt: Sicht-Balken einrücken, damit der Floating-Button die Beschriftung nicht überdeckt */
body.sidebar-collapsed .sicht-bar { padding-left: 52px; }

body.no-sidebar .app-main::before {
    content: '💰 AVA-Bau · Abrechnungs-Fenster';
    display: block; padding: 6px 20px;
    background: linear-gradient(90deg, #1e3a8a, #1e40af);
    color: #fef3c7; font-size: 12px; font-weight: 600;
    letter-spacing: .04em;
    border-bottom: 1px solid rgba(0,0,0,.15);
    position: sticky; top: 0; z-index: 100;
}
body.no-sidebar .page-back { margin: 12px 24px 0; }
body.no-sidebar > .app-layout > .app-main > *:not(.page-back):not(.sicht-bar) {
    /* Inhalts-Wrapper bekommen normales Padding */
    padding-left: 24px; padding-right: 24px;
}

/* ─── AG/AN-Sicht visuell trennen ─────────────────────────────────────
   Linker farbiger Akzent-Streifen am Hauptinhalt + Sidebar-Section-Border.
   Stärker als das vorhandene Toggle, damit User sofort sieht in welchem Modus. */
/* Default-Werte (CSS-Variablen) — werden in header.php pro Request mit den
   app-settings-Werten (banner_color_ag_from/to bzw. _an_from/to) überschrieben,
   damit Sicht-Banner farblich konsistent zum Projekt-Banner bleibt. */
body.ava-sicht-ag { --sicht-grad-from: #1e40af; --sicht-grad-to: #2563eb; --sicht-grad-accent: #1e40af; }
body.ava-sicht-an { --sicht-grad-from: #b45309; --sicht-grad-to: #d97706; --sicht-grad-accent: #b45309; }

body.ava-sicht-ag .app-main { box-shadow: inset 5px 0 0 0 var(--sicht-grad-accent); }
body.ava-sicht-an .app-main { box-shadow: inset 5px 0 0 0 var(--sicht-grad-accent); }
/* Sicht-Balken — echtes Flex-Element (ersetzt das frühere .app-main::before).
   align-items:center → Symbol & Text vertikal zentriert; nimmt Aktions-Buttons auf.
   Label/Farbe kommen aus header.php bzw. den --sicht-grad-Variablen oben. */
.sicht-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 22px; margin-bottom: 12px;  /* kleiner Abstand zum Projekt-Banner darunter */
    background: linear-gradient(90deg, var(--sicht-grad-from), var(--sicht-grad-to));
    color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .04em;
    border-bottom: 1px solid rgba(0,0,0,.15); box-shadow: 0 2px 6px rgba(0,0,0,.18);
    position: sticky; top: 0; z-index: 100; text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.sicht-bar .sb-label { display: inline-flex; align-items: center; gap: 7px; line-height: 1.1; }
.sicht-bar .sb-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sicht-bar .sb-extra { display: inline-flex; align-items: center; gap: 8px; }
.sicht-bar .sb-btn {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.40);
    border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600;
    cursor: pointer; text-decoration: none; text-shadow: none; line-height: 1.2;
}
.sicht-bar .sb-btn:hover { background: rgba(255,255,255,.30); }
.sicht-bar .sb-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
/* Breadcrumb-Leiste (schließt unter der Sicht-Bar an; aus $breadcrumbs in header.php) */
.breadcrumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 7px 22px; margin: -12px 0 14px;
    font-size: 12.5px; color: var(--fg-muted);
    border-bottom: 1px solid var(--border-soft);
}
.breadcrumbs .bc-item { color: var(--fg-muted); text-decoration: none; }
.breadcrumbs .bc-item:hover { color: var(--fg); text-decoration: underline; }
.breadcrumbs .bc-cur { color: var(--fg); font-weight: 600; }
.breadcrumbs .bc-sep { color: var(--border); font-weight: 400; }
body.no-sidebar .app-main > h1,
body.no-sidebar .app-main > p,
body.no-sidebar .app-main > div,
body.no-sidebar .app-main > nav,
body.no-sidebar .app-main > section,
body.no-sidebar .app-main > iframe { padding-left: 24px; padding-right: 24px; box-sizing: border-box; }
body.no-sidebar .app-main > iframe { padding-left: 0; padding-right: 0; }
.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-side);
    color: var(--fg-side);
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;      /* Sidebar scrollt selbst, falls Inhalt zu lang */
    height: 100vh;
}
.app-sidebar .brand {
    padding: 0 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 14px;
}
.app-sidebar .brand h1 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.app-sidebar .brand .sub {
    margin: 2px 0 0;
    font-size: 11px;
    color: rgba(255,255,255,.72);
    letter-spacing: .03em;
}
.app-sidebar .sidebar-sicht {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: 8px 14px 4px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0,0,0,.18);
}
.app-sidebar .sidebar-sicht a {
    /* override .app-sidebar a (display: flex; padding: 8px 12px; margin-bottom: 1px;) */
    display: block !important;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    text-align: center;
    padding: 5px 4px !important;
    margin-bottom: 0 !important;
    font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    letter-spacing: .04em;
    border-right: 1px solid rgba(255,255,255,.08);
    border-radius: 0 !important;
    transition: background .12s, color .12s;
}
.app-sidebar .sidebar-sicht a:last-child { border-right: 0; }
.app-sidebar .sidebar-sicht a:hover { color: #fff; background: rgba(255,255,255,.06); }
.app-sidebar .sidebar-sicht a.active {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
}
.app-sidebar a.rolle-dim { opacity: 0.45; }
.app-sidebar a.rolle-dim:hover { opacity: 0.8; }

.app-sidebar nav { flex: 1; padding: 0 10px; }
.app-sidebar .group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.62);
    padding: 10px 10px 4px;
}
.app-sidebar .group-ag {
    color: #bfdbfe;
    border-left: 3px solid #3b82f6;
    padding-left: 10px;
    margin-left: -3px;
    font-weight: 700;
}
.app-sidebar .group-an {
    color: #fde68a;
    border-left: 3px solid #f59e0b;
    padding-left: 10px;
    margin-left: -3px;
    font-weight: 700;
}
.app-sidebar a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px;
    color: var(--fg-side);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 1px;
    transition: background .12s, color .12s;
}
.app-sidebar a:hover { background: var(--bg-side-hov); color: #fff; }
.app-sidebar a.active { background: var(--bg-side-act); color: var(--fg-side-act); font-weight: 500; }
.app-sidebar a.disabled { color: rgba(255,255,255,.3); pointer-events: none; }
.app-sidebar .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Ausklappbare Untermenüs */
.app-sidebar .nav-parent { display: flex; align-items: stretch; gap: 2px; }
.app-sidebar .nav-parent .nav-parent-link { flex: 1; margin-bottom: 1px; }
.app-sidebar .subnav-toggle {
    flex-shrink: 0;
    width: 28px;
    margin-bottom: 1px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--fg-side);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .6;
    transition: background .12s, opacity .12s;
}
.app-sidebar .subnav-toggle:hover { background: var(--bg-side-hov); color: #fff; opacity: 1; }
.app-sidebar .subnav-parent-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 5px 12px;
    margin-bottom: 1px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--fg-side);
    font-family: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.app-sidebar .subnav-parent-btn:hover { background: var(--bg-side-hov); color: #fff; }
.app-sidebar .subnav-parent-btn .subnav-parent-label { flex: 1; }
.app-sidebar .subnav-chevron { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; transition: transform .18s ease; }
.app-sidebar .nav-group.collapsed .subnav-chevron { transform: rotate(-90deg); }
.app-sidebar .subnav {
    overflow: hidden;
    max-height: 400px;
    transition: max-height .2s ease;
}
.app-sidebar .nav-group.collapsed .subnav { max-height: 0; }
.app-sidebar .subnav a {
    padding-left: 36px;
    font-size: 13px;
    color: rgba(255,255,255,.92);
}
.app-sidebar .subnav a.active { color: var(--fg-side-act); }

/* Ausklappbare Sektionen (Überschrift = Toggle) */
.app-sidebar .group-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.app-sidebar .group-toggle .subnav-chevron { width: 13px; height: 13px; margin-left: auto; }
.app-sidebar .group-toggle:hover { color: rgba(255,255,255,.9); }
body.sidebar-light .app-sidebar .group-toggle:hover { color: #1e293b; }
.app-sidebar .nav-section { overflow: hidden; max-height: 1200px; transition: max-height .25s ease; }
.app-sidebar .nav-group.collapsed > .nav-section { max-height: 0; }

/* Helle Seitenleiste (Toggle, Variante zum Ausprobieren) — Zustand in localStorage.
   Überschreibt nur die für-dunkel hartcodierten Sidebar-Regeln, scoped unter body.sidebar-light. */
body.sidebar-light .app-sidebar {
    --bg-side:      #f8fafc;
    --bg-side-hov:  #e8edf3;
    --bg-side-act:  #eff6ff;
    --fg-side:      #1e293b;
    --fg-side-act:  #1d4ed8;
    border-right: 1px solid #e2e8f0;
}
/* Heller Modus: den 5px-Sicht-Akzentstreifen am Arbeitsflächen-Rand weglassen
   (stört den nahtlosen Übergang; die AG/AN-Welt zeigt weiterhin der Sicht-Balken oben). */
body.sidebar-light .app-main { box-shadow: none; }
body.sidebar-light .app-sidebar .brand { border-bottom-color: #e2e8f0; }
body.sidebar-light .app-sidebar .brand h1 { color: #0f172a; }
body.sidebar-light .app-sidebar .brand .sub { color: #475569; }
body.sidebar-light .app-sidebar .group { color: #64748b; }
body.sidebar-light .app-sidebar .group-ag { color: #1d4ed8; border-left: 0; margin-left: 0; }
body.sidebar-light .app-sidebar .group-an { color: #b45309; border-left: 0; margin-left: 0; }
body.sidebar-light .app-sidebar a:hover,
body.sidebar-light .app-sidebar .subnav-toggle:hover,
body.sidebar-light .app-sidebar .subnav-parent-btn:hover { color: #0f172a; }
body.sidebar-light .app-sidebar nav a.active,
body.sidebar-light .app-sidebar .nav-parent-link.active { border-left: 3px solid #2563eb; border-radius: 0; }
body.sidebar-light .app-sidebar .subnav a { color: #334155; }
body.sidebar-light .app-sidebar .footer { border-top-color: #e2e8f0; color: #475569; }
body.sidebar-light .app-sidebar .footer .user { color: #0f172a; }
body.sidebar-light .app-sidebar .footer a { color: #475569; }
body.sidebar-light .app-sidebar .footer a:hover { color: #0f172a; }
body.sidebar-light .sidebar-collapse-btn:hover { background: rgba(0,0,0,.06); }
body.sidebar-light .app-sidebar .sidebar-sicht { border-color: #cbd5e1; background: #ffffff; }
body.sidebar-light .app-sidebar .sidebar-sicht a { color: #64748b; border-right-color: #e2e8f0; }
body.sidebar-light .app-sidebar .sidebar-sicht a:hover { color: #0f172a; background: #f1f5f9; }

.sidebar-light-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.6);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 12px;
    transition: color .12s, border-color .12s;
}
.sidebar-light-toggle:hover { color: #fff; border-color: rgba(255,255,255,.4); }
body.sidebar-light .sidebar-light-toggle { border-color: #cbd5e1; color: #475569; }
body.sidebar-light .sidebar-light-toggle:hover { color: #0f172a; border-color: #94a3b8; }
.app-sidebar .footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 12px;
    color: rgba(255,255,255,.7);
}
.app-sidebar .footer .user { color: #fff; font-weight: 500; }
.app-sidebar .footer a {
    display: inline; padding: 0; margin: 0; color: rgba(255,255,255,.8);
    text-decoration: none;
}
.app-sidebar .footer a:hover { color: #fff; background: transparent; }

.app-main {
    flex: 1;
    padding: 24px 32px;
    min-width: 0;
    overflow-y: auto;      /* Hauptbereich scrollt unabhängig von der Sidebar */
    height: 100vh;
}
.app-main h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }

/* Global Back-Button — oberhalb des Page-Contents */
.page-back {
    margin: -8px 0 12px;
    display: flex;
    gap: 6px;
}
.page-back .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12.5px;
    color: var(--fg-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s;
}
.page-back .back-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.page-back .back-btn svg { width: 14px; height: 14px; }
.app-main h2 { font-size: 16px; margin: 24px 0 10px; color: var(--fg-muted); font-weight: 600; }
.app-main h2:first-child { margin-top: 0; }

/* ---------- Components ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.card h2 { margin-top: 0; }

/* ── Dev-Owner Rollen-Vorschau-Schalter (nur echter Owner-Admin sichtbar) ── */
.dev-viewbar {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: 12px; padding: 5px 14px;
    background: #1e293b; color: #e2e8f0; border-bottom: 1px solid #334155;
}
.dev-viewbar.is-sim { background: #7c2d12; border-bottom-color: #9a3412; } /* Warnfarbe bei aktiver Vorschau */
.dev-viewbar .dvb-lbl { font-weight: 600; opacity: .92; cursor: help; }
.dev-viewbar .dvb-btn {
    padding: 2px 11px; border-radius: 6px; text-decoration: none;
    color: #e2e8f0; border: 1px solid transparent; font-weight: 500; line-height: 1.6;
}
.dev-viewbar .dvb-btn:hover { background: rgba(255,255,255,.14); }
.dev-viewbar .dvb-btn.active { background: #2563eb; color: #fff; }
.dev-viewbar.is-sim .dvb-btn.active { background: #f59e0b; color: #3b1a05; }
.dev-viewbar .dvb-note { margin-left: auto; font-size: 11.5px; opacity: .95; }
.dev-viewbar .dvb-note a { color: #fde68a; font-weight: 600; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
table th, table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
}
table th { background: var(--bg); font-weight: 600; color: var(--fg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
/* Spaltenkopf bleibt beim Scrollen am oberen Rand des Hauptbereichs hängen.
   Sticky-Container = .app-main (scroll-context). */
table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 1px 0 var(--border);   /* dezente Trennlinie unter dem Kopf */
}
table tr:last-child td { border-bottom: 0; }
table tr:hover td { background: var(--bg); }

code { background: var(--border-soft); padding: 1px 6px; border-radius: 3px; font-size: 12.5px; }

.btn {
    display: inline-block;
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    background: var(--primary);
    transition: background .12s;
}
.btn:hover { background: var(--primary-hov); }
.btn-secondary { background: var(--bg); color: var(--fg); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-soft); }
.btn-danger { background: var(--danger); }

/* Outline-Buttons — heller Grund + Semantik-Farbe als Rand + Schrift (Optik wie der
   „Projekt löschen"-Button); Farben bleiben. Greift, wenn ENTWEDER das Profil
   button_style=outline gewählt ist (body.btn-outline) ODER der helle Modus aktiv ist
   (body.sidebar-light → helles Thema schaltet Outline automatisch ein). */
body:is(.btn-outline, .sidebar-light) .btn {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
}
body:is(.btn-outline, .sidebar-light) .btn:hover { background: #eff6ff; }
body:is(.btn-outline, .sidebar-light) .btn-secondary {
    background: var(--bg-card);
    color: var(--fg);
    border-color: var(--border);
}
body:is(.btn-outline, .sidebar-light) .btn-secondary:hover { background: #f1f5f9; }
body:is(.btn-outline, .sidebar-light) .btn-danger {
    background: var(--bg-card);
    color: var(--danger);
    border: 1px solid var(--danger);
}
body:is(.btn-outline, .sidebar-light) .btn-danger:hover { background: #fef2f2; }
body:is(.btn-outline, .sidebar-light) .btn-success {
    background: var(--bg-card);
    color: var(--success);
    border: 1px solid var(--success);
}
body:is(.btn-outline, .sidebar-light) .btn-success:hover { background: #ecfdf5; }
body:is(.btn-outline, .sidebar-light) .btn-warn,
body:is(.btn-outline, .sidebar-light) .btn-warning {
    background: var(--bg-card);
    color: var(--warn);
    border: 1px solid var(--warn);
}
body:is(.btn-outline, .sidebar-light) .btn-warn:hover,
body:is(.btn-outline, .sidebar-light) .btn-warning:hover { background: #fffbeb; }

/* Badges im Outline/hellen Modus weich getönt — satte Vollfarbe → heller Tint +
   Farbschrift derselben Semantik-Farbe (Status bleibt erkennbar, passt zu Outline). */
/* grau — Vorbereitung */
body:is(.btn-outline,.sidebar-light) .lvart-Entwurfs-LV,
body:is(.btn-outline,.sidebar-light) .lvart-Kostenschaetzungs-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-vorbereitung,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="vorbereitung"][aria-selected="true"] .phase-tab-badge { background:#f1f5f9; color:#475569; }
/* amber — Ausschreibung */
body:is(.btn-outline,.sidebar-light) .lvart-Ausschreibungs-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-ausschreibung,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="ausschreibung"][aria-selected="true"] .phase-tab-badge { background:#fef3c7; color:#b45309; }
/* blau — Angebot */
body:is(.btn-outline,.sidebar-light) .lvart-Angebots-LV,
body:is(.btn-outline,.sidebar-light) .lvart-Alternativangebots-LV,
body:is(.btn-outline,.sidebar-light) .lvart-Abaenderungsangebots-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-angebot,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="angebot"][aria-selected="true"] .phase-tab-badge { background:#dbeafe; color:#1e40af; }
/* grün — Vertrag */
body:is(.btn-outline,.sidebar-light) .lvart-Vertrags-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-vertrag,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="vertrag"][aria-selected="true"] .phase-tab-badge { background:#d1fae5; color:#047857; }
/* violett — Nachtrag */
body:is(.btn-outline,.sidebar-light) .lvart-Zusatzangebots-LV,
body:is(.btn-outline,.sidebar-light) .lvart-Vertragsanpassungs-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-nachtrag,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="nachtrag"][aria-selected="true"] .phase-tab-badge { background:#ede9fe; color:#6d28d9; }
/* rot — Abrechnung */
body:is(.btn-outline,.sidebar-light) .lvart-Abrechnungs-LV,
body:is(.btn-outline,.sidebar-light) .lvg-phase-chip.phase-abrechnung,
body:is(.btn-outline,.sidebar-light) .phase-tab[data-phase="abrechnung"][aria-selected="true"] .phase-tab-badge { background:#ffe4e6; color:#be123c; }
/* LV-Code-Pille (blau gefüllt) → getönt */
body:is(.btn-outline,.sidebar-light) .lv-group h2 code { background:#dbeafe; color:#1e40af; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.flash-ok   { background: #d1fae5; color: #065f46; border-left: 3px solid #059669; }
.flash-err  { background: #fee2e2; color: #991b1b; border-left: 3px solid #dc2626; }
.flash-warn { background: #fef3c7; color: #92400e; border-left: 3px solid #d97706; }

.muted { color: var(--fg-muted); font-weight: 450; }
.ok    { color: var(--success); font-weight: 500; }
.fail  { color: var(--danger); font-weight: 500; }

/* Tabellen-Header: kräftigerer Kontrast */
table th { color: var(--fg) !important; font-weight: 700; }
/* Tabellen-Bodyzellen: kein blass-grau, sondern echtes Schwarz */
table td { color: var(--fg); }
/* Code-Snippets dunkler & lesbarer */
code { color: #0f172a; background: #e2e8f0; font-weight: 500; }
body.theme-dark code { color: #f1f5f9; background: #334155; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--fg);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ---------- Radio-Liste (Nachlass-Ebene & Co.) ---------- */
.radio-list {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 4px;
    font-size: 13px;
    width: 100%;
}
.radio-list label,
.field .radio-list label {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    align-self: flex-start !important;
    width: auto !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: var(--fg) !important;
    margin: 0 !important;
    padding: 2px 0 !important;
    gap: 6px;
    cursor: pointer;
}
.radio-list label input[type="radio"] {
    width: auto !important;
    margin: 0 !important;
    flex: 0 0 auto;
}
.radio-list label > span {
    text-align: left !important;
}

/* ---------- Drop-Zone ---------- */
.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: var(--bg);
    transition: border-color .15s, background .15s;
    cursor: pointer;
}
.dropzone:hover { border-color: var(--primary); background: var(--bg-card); }
.dropzone.is-dragover {
    border-color: var(--primary);
    background: rgba(37,99,235,.06);
    border-style: solid;
}
.dropzone .dz-input { /* das original input ausblenden, aber zugänglich halten */
    position: absolute; opacity: 0; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
    border: 0;
}
.dropzone .dz-inner {
    padding: 28px 22px;
    text-align: center;
    color: var(--fg-muted);
    pointer-events: auto;
}
.dropzone.has-files .dz-inner { padding-top: 18px; padding-bottom: 18px; }
.dropzone .dz-icon { color: var(--primary); margin-bottom: 8px; }
.dropzone.is-dragover .dz-icon { transform: scale(1.06); transition: transform .15s; }
.dropzone .dz-label { margin: 0; font-size: 14px; color: var(--fg); font-weight: 500; }
.dropzone .dz-link { color: var(--primary); text-decoration: underline; }
.dropzone .dz-hint { margin: 4px 0 0; font-size: 12px; color: var(--fg-muted); }
.dropzone .dz-list {
    list-style: none; padding: 0; margin: 14px 0 0;
    text-align: left;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.dropzone .dz-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 10px; font-size: 13px;
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: 5px; margin-bottom: 4px;
}
.dropzone .dz-file-name { font-size: 12.5px; color: var(--fg); }
.dropzone .dz-file-size { color: var(--fg-muted); font-size: 12px; }

/* ---------- Scroll-Top / Scroll-Bottom Buttons ---------- */
.scroll-controls {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}
.scroll-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--fg-muted);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.10);
    transition: background .15s, color .15s, transform .12s, opacity .15s, visibility .15s;
}
.scroll-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}
.scroll-btn svg { width: 18px; height: 18px; }
.scroll-btn.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- Print / PDF — farbig, Hintergründe erzwingen ---------- */
@media print {
    /* Schmale Ränder + Querformat → maximale Tabellenbreite */
    @page { size: A4 landscape; margin: 5mm 5mm 8mm 5mm; }

    /* (A3-Spezialgröße via Browser-Druckdialog wählen — @page kann nicht in
       einen Class-Selector verschachtelt werden, daher hier kein .print-a3-Hack.) */

    html, body { font-size: 9pt !important; }

    /* Browser zwingen, ALLE Farben + Hintergründe zu drucken */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Sidebar, Navigation, Buttons unsichtbar im Druck */
    .app-sidebar,
    .scroll-controls,
    .page-back,
    .no-print,
    nav, aside,
    button { display: none !important; }

    .app-layout { display: block !important; height: auto !important; }
    .app-main {
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
    }
    body { background: #fff; }

    /* Tabellen druckfreundlich — Header + Highlights bleiben farbig */
    table {
        border-collapse: collapse;
        page-break-inside: auto;
        width: 100% !important;
        table-layout: auto;
        font-size: 8pt !important;
    }
    table thead { display: table-header-group; }    /* Header auf jeder Druckseite */
    table tr    { page-break-inside: avoid; }
    table th, table td {
        border: 1px solid #cbd5e1;
        padding: 2px 4px !important;
        word-break: break-word;
        white-space: normal !important;        /* Spalten dürfen umbrechen statt überlaufen */
        line-height: 1.25 !important;
    }
    table thead th     { background: #eff6ff !important; color: #1e3a8a !important; font-weight: 700; font-size: 7.5pt !important; }
    tfoot td           { background: #f8fafc !important; font-weight: 700; border-top: 2px solid #1e3a8a !important; }

    /* Preisspiegel: alle Spalten gleichmäßig schmal; horizontalen Scroll abschalten */
    .ps-wrap { overflow: visible !important; width: 100% !important; }
    table.ps {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 7.5pt !important;
    }
    table.ps th, table.ps td {
        padding: 2px 3px !important;
        font-size: inherit !important;
    }
    table.ps .col-stw   { min-width: 0 !important; max-width: none !important; }
    table.ps .col-num   { font-size: 7.5pt !important; }

    /* Preisspiegel-Highlights: günstigster grün, teuerster rot */
    table.ps .row-cheap   { background: #dcfce7 !important; }   /* hellgrün */
    table.ps .row-exp     { background: #fee2e2 !important; }   /* hellrot  */
    table.ps .bieter-head { background: #eff6ff !important; color: #1e3a8a !important; border-bottom: 2px solid #2563eb !important; border-left: 2px solid #6366f1 !important; }
    table.ps .sum-best    { color: #059669 !important; font-weight: 700; }

    /* Bieter-Trennlinie auch im Druck — analog Preisdatenbank_2_0 */
    table.ps .first-of-bieter { border-left: 2px solid #6366f1 !important; }

    /* Hover/Zebra im Druck aus */
    table tr:hover td, table.ps tbody tr:hover td { background: inherit !important; }

    /* Zuschlag-Markierung in Bestbieter farbig erhalten */
    .lv-row-zuschlag { background: #fef3c7 !important; }   /* gold */

    /* Cards */
    .card { box-shadow: none !important; border: 1px solid #cbd5e1; page-break-inside: avoid; }
    .ps-wrap, .scan-wrap { overflow: visible !important; }
    table.ps .col-stw { white-space: normal; }

    /* Bestbieter-Header: Goldverlauf bleibt erhalten dank print-color-adjust */
    .bb-header {
        background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%) !important;
        color: #fff !important;
    }
    .bb-header h1 { color: #fff !important; }
    .bb-stat                 { page-break-inside: avoid; }
    .bb-stat.cheapest .v     { color: #059669 !important; }
    .bb-stat.expensive .v    { color: #dc2626 !important; }

    /* Sticky-Cells im Druck deaktivieren — sonst überlappen sie */
    table.ps thead th, table.ps tbody td, table thead th { position: static !important; }

    a { color: #1e3a8a !important; text-decoration: none !important; }
    h1 { font-size: 13pt !important; margin: 0 0 4px !important; }
    h2 { font-size: 10pt !important; margin: 6px 0 4px !important; }
    p  { margin: 2px 0 !important; }

    /* Cards eng: weniger Innenrand fürs Drucken */
    .card { padding: 6px 8px !important; margin-bottom: 6px !important; border: 1px solid #cbd5e1 !important; }
    .ps-wrap { border: none !important; }

    /* Bestbieter-Stats-Grid auf eine Zeile drücken */
    .bb-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important; gap: 4px !important; margin-bottom: 6px !important; }
    .bb-stat  { padding: 4px 8px !important; }
    .bb-stat .v { font-size: 12pt !important; margin-top: 0 !important; }
    .bb-stat .l { font-size: 7pt !important; }
    .bb-header { padding: 6px 10px !important; margin-bottom: 6px !important; }
    .bb-header h1 { font-size: 12pt !important; }

    /* Flash-Boxen */
    .flash-ok   { background: #d1fae5 !important; color: #065f46 !important; border-left: 3px solid #059669 !important; }
    .flash-warn { background: #fef3c7 !important; color: #92400e !important; border-left: 3px solid #d97706 !important; }
    .flash-err  { background: #fee2e2 !important; color: #991b1b !important; border-left: 3px solid #dc2626 !important; }
}

/* ── Startseite-Dashboard ───────────────────────────────────────────── */
/* Welt-Akzente (--ag-rgb / --an-rgb) werden in partials/home_dashboard.php
   inline auf .dash gesetzt — aus den admin-konfigurierten Projekt-Banner-
   Farben (admin_settings.php, „from"-Ton). Die Werte hier sind nur Fallback,
   falls die Injektion fehlt. */
:root, body.theme-light { --ag-rgb: 37,99,235;  --an-rgb: 94,165,41;  --ag-fg: 33,87,131;  --an-fg: 52,105,52; }
body.theme-dark        { --ag-rgb: 96,165,250; --an-rgb: 132,204,80; --ag-fg: 96,165,250; --an-fg: 132,204,80; }

.dash-greeting {
    display: flex; align-items: center; gap: 14px;
    margin: 4px 0 18px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}
.dash-greeting .dash-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }

.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }

.dash-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 0 26px; }
@media (max-width: 720px) { .dash-kpis { grid-template-columns: 1fr; } }
.kpi-group {
    position: relative; overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px 18px 16px 20px;
}
.kpi-group::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi-group-ag::before { background: rgb(var(--ag-rgb)); }
.kpi-group-an::before { background: rgb(var(--an-rgb)); }
.kpi-group-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--fg); font-weight: 700; margin: 0 0 12px;
}
.kpi-group-ag .kpi-group-title::before,
.kpi-group-an .kpi-group-title::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.kpi-group-ag .kpi-group-title::before { background: rgb(var(--ag-rgb)); }
.kpi-group-an .kpi-group-title::before { background: rgb(var(--an-rgb)); }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-card {
    display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 15px; border: 1px solid var(--border-soft); border-radius: 10px;
    background: var(--bg); text-decoration: none; color: var(--fg);
    transition: border-color .12s, background-color .12s;
}
/* 2-zeilig: links Zahl + Label, rechts das Symbol (wie Modul-Kachel, kompakt) */
.kpi-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-icon { line-height: 0; flex-shrink: 0; }
.kpi-icon svg { stroke-width: 2.2; }   /* etwas fetter als Standard (1.75) */
.kpi-ag .kpi-icon { color: rgb(var(--ag-fg)); }
.kpi-an .kpi-icon { color: rgb(var(--an-fg)); }
.kpi-ag:hover { border-color: rgba(var(--ag-rgb), .55); background: rgba(var(--ag-rgb), .07); }
.kpi-an:hover { border-color: rgba(var(--an-rgb), .55); background: rgba(var(--an-rgb), .07); }
.kpi-num { font-size: 30px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-ag .kpi-num { color: rgb(var(--ag-fg)); }
.kpi-an .kpi-num { color: rgb(var(--an-fg)); }
.kpi-label { font-size: 12.5px; color: var(--fg-muted); font-weight: 600; }

.dash-recent { margin: 0 0 24px; }
.dash-recent-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.dash-recent-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 4px;
    min-width: 200px; flex: 1 1 220px; max-width: 320px;
    padding: 11px 13px 11px 16px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-card); text-decoration: none; color: var(--fg);
    transition: border-color .12s, background-color .12s;
}
.dash-recent-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.dash-recent-ag::before { background: rgb(var(--ag-rgb)); }
.dash-recent-an::before { background: rgb(var(--an-rgb)); }
.dash-recent-ag:hover { border-color: rgba(var(--ag-rgb), .55); background: rgba(var(--ag-rgb), .06); }
.dash-recent-an:hover { border-color: rgba(var(--an-rgb), .55); background: rgba(var(--an-rgb), .06); }
.dash-welt-badge { align-self: flex-start; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: .04em; }
.dash-welt-ag { background: rgba(var(--ag-rgb), .14); color: rgb(var(--ag-fg)); }
.dash-welt-an { background: rgba(var(--an-rgb), .16); color: rgb(var(--an-fg)); }
.dash-recent-code  { font-family: ui-monospace, monospace; font-size: 12px; color: var(--fg-muted); }
.dash-recent-title { font-size: 13px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rechnung_edit.php: Hinweis bei RR (Regie) — Abzugsfelder ausgeblendet per B 2110 Pkt. 8.4 */
.rr-edit-hint{font-size:13px;color:#7a3232;background:#fbeaea;border-left:3px solid #b06a6a;padding:8px 12px;border-radius:6px;margin:8px 0;}
body.theme-dark .rr-edit-hint{color:#fca5a5;background:#450a0a;border-left-color:#991b1b;}

/* Rechnungsart-Filter-Chips (abrechnung_rechnungen.php) */
/* Badge-Farben via .rch-art.AR/.TS/.SR/.RR/.ER (inline-Regeln in abrechnung_rechnungen.php) */
.rart-filter{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 12px;}
.rart-chip{font-size:12px;font-weight:600;padding:5px 12px;border-radius:16px;border:1px solid #cdd6e0;background:#fff;color:#33414f;cursor:pointer;transition:background .12s,border-color .12s;}
.rart-chip:hover{border-color:#9fb0c2;}
.rart-chip.is-active{background:#33414f;border-color:#33414f;color:#fff;}
body.theme-dark .rart-chip{background:#2a2a2a;color:#e0e0e0;border-color:#444;}
body.theme-dark .rart-chip.is-active{background:#e0e0e0;color:#1a1a1a;border-color:#e0e0e0;}

/* ZA-Positions-Status (AG-Teilanerkennung, ÖNORM A 2063 Pkt. 3.3.9) */
.za-status{display:inline-block;font-size:10.5px;font-weight:700;line-height:1;padding:2px 7px;border-radius:5px;letter-spacing:.02em;vertical-align:middle;}
.za-beantragt{background:#fef3c7;color:#92400e;}
.za-genehmigt{background:#dcfce7;color:#166534;}
.za-abgelehnt{background:#fee2e2;color:#991b1b;}
.za-actions{display:inline-flex;gap:3px;margin-left:6px;vertical-align:middle;}
.za-actions button{font-size:10.5px;line-height:1;padding:2px 6px;border-radius:4px;border:1px solid #cdd6e0;background:#fff;color:#33414f;cursor:pointer;}
.za-actions button:hover{border-color:#9fb0c2;}
.za-actions button.za-btn-ok:hover{background:#dcfce7;border-color:#166534;}
.za-actions button.za-btn-no:hover{background:#fee2e2;border-color:#991b1b;}
body.theme-dark .za-beantragt{background:#422006;color:#fde68a;}
body.theme-dark .za-genehmigt{background:#052e16;color:#86efac;}
body.theme-dark .za-abgelehnt{background:#450a0a;color:#fca5a5;}
body.theme-dark .za-actions button{background:#2a2a2a;color:#e0e0e0;border-color:#444;}

/* ── Workflow-Assistent (Stepper-Panel) ───────────────────────────── */
.asst-panel{position:sticky;top:12px;align-self:flex-start;width:330px;max-width:330px;
  background:var(--card,#fff);border:1px solid var(--line,#e3e8ee);border-radius:10px;
  padding:14px 14px 18px;font-size:13px;}
.asst-panel.asst-collapsed{padding:8px 12px;}
.asst-hd{display:flex;align-items:center;gap:8px;margin-bottom:6px;}
.asst-hd h2{font-size:14px;margin:0;}
.asst-hd .asst-ic{font-size:17px;}
.asst-hd .asst-min{margin-left:auto;background:none;border:1px solid var(--line,#e3e8ee);
  border-radius:5px;width:26px;height:26px;cursor:pointer;color:#6b7785;}
.asst-hd .asst-close{background:none;border:1px solid var(--line,#e3e8ee);border-radius:5px;
  width:26px;height:26px;cursor:pointer;color:#6b7785;line-height:1;font-size:12px;}
.asst-hd .asst-close:hover{border-color:#e6b4ae;color:#b42318;background:#fbecea;}
/* Kopf-Buttons: Flat-Icon mittig + Chevron dreht beim Einklappen */
.asst-hd .asst-reset,.asst-hd .asst-min,.asst-hd .asst-close{display:inline-flex;align-items:center;justify-content:center;padding:0;}
.asst-hd .asst-min .flatic{transition:transform .15s ease;}
.asst-hd .asst-min.asst-min-up .flatic{transform:rotate(180deg);}
.asst-ic .flatic{vertical-align:middle;}
.asst-wfname{font-size:12px;color:#6b7785;margin:0 0 10px;}
.asst-sicht{display:inline-block;font-size:10.5px;padding:1px 7px;border-radius:9px;color:#fff;background:#6b21a8;}
.asst-prog{height:6px;background:#eef1f5;border-radius:4px;overflow:hidden;margin-bottom:12px;}
.asst-prog>i{display:block;height:100%;background:#6b21a8;}
.asst-steps{list-style:none;margin:0;padding:0;}
.asst-steps>li{position:relative;padding:0 0 13px 28px;border-left:2px solid var(--line,#e3e8ee);margin-left:9px;}
.asst-steps>li:last-child{border-left-color:transparent;}
.asst-dot{position:absolute;left:-11px;top:0;width:20px;height:20px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;font-size:11px;background:#eef1f5;color:#6b7785;border:2px solid var(--card,#fff);}
.asst-steps>li.done .asst-dot{background:#15803d;color:#fff;}
.asst-steps>li.current .asst-dot{background:#6b21a8;color:#fff;box-shadow:0 0 0 4px rgba(107,33,168,.15);}
.asst-st{font-size:13px;font-weight:600;line-height:20px;}

/* Projektansicht — Aktionen/Hinweise je Phasen-Panel */
.pv-phase-actions { display:flex; gap:6px; flex-wrap:wrap; margin:0 0 10px; }
.pv-phase-actions .pv-pa { font-size:12px; padding:4px 12px; margin:0; display:inline-flex; align-items:center; gap:6px; }
/* Phasen-Buttons (blau) + Gewerk-/Code-Aktionen (grau) auf EINER Zeile */
.pv-phase-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:0 0 10px; }
.pv-phase-toolbar .pv-phase-actions { margin:0; }
.pv-phase-editbar { display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; }
/* dezenter Trenner zwischen blauen Phasen-Aktionen und den grauen Gewerk-/Code-Tools */
.pv-phase-toolbar .pv-phase-actions + .pv-phase-editbar { padding-left:12px; border-left:1px solid var(--border); }
.pv-phase-editbar .btn { margin:0; }

/* Projektansicht — dimmbare Leer-Tabs + Card-Phasen-Badge */
.phase-tab.phase-tab-empty { opacity:.5; }
.phase-tab.phase-tab-empty .phase-tab-badge { background:transparent; color:var(--fg-muted); }
.lvg-phase-badge { display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px;
    background:var(--border-soft); color:var(--fg); margin-left:8px; vertical-align:middle; }
.pv-phase-hint { color:var(--fg-muted); font-size:12px; font-style:italic; margin:4px 0 10px; }
.asst-steps>li.done .asst-st{color:#6b7785;font-weight:500;}
.asst-steps>li.current .asst-st{color:#6b21a8;}
.asst-body{margin-top:6px;}
.asst-hint{font-size:12px;color:#374151;background:#faf7ef;border:1px solid #ecd9b0;border-radius:6px;padding:8px 10px;margin:6px 0 8px;}
.asst-cta{display:inline-block;background:#6b21a8;color:#fff;text-decoration:none;border-radius:5px;padding:6px 12px;font-size:12px;}
.asst-more{font-size:11px;color:#6b21a8;margin-left:10px;text-decoration:none;}
.asst-switch{margin-top:14px;border-top:1px solid var(--line,#e3e8ee);padding-top:10px;}
.asst-switch select{width:100%;padding:6px;border:1px solid var(--line,#e3e8ee);border-radius:5px;font-size:12px;}
.asst-legend{font-size:10.5px;color:#6b7785;margin-top:8px;}
/* Runde abgeschlossen → neuen Zusatzauftrag anbieten (flach, gedeckt, AA) */
.asst-done{display:flex;gap:9px;align-items:flex-start;background:#eef6f0;border:1px solid #bcdcc7;border-radius:6px;padding:9px 11px;margin-top:4px;}
.asst-done-ic{flex:0 0 auto;width:20px;height:20px;border-radius:50%;background:#15803d;color:#fff;display:inline-flex;align-items:center;justify-content:center;}
.asst-done-ic .flatic{vertical-align:0;}
.asst-done-tx{font-size:12px;color:#1f3d29;line-height:1.45;}
.asst-cta-new{display:inline-flex;align-items:center;gap:5px;margin-top:8px;background:#15803d;}
/* sanfter Nächster-Schritt-Hinweis */
.asst-hint-banner{display:flex;align-items:center;gap:10px;background:#eef2ff;border:1px solid #c7d2fe;
  color:#3730a3;border-radius:8px;padding:10px 14px;font-size:13px;margin-bottom:14px;}
.asst-hint-banner .ahb-go{margin-left:auto;background:#3730a3;color:#fff;border:none;border-radius:5px;padding:6px 12px;font-size:12px;text-decoration:none;white-space:nowrap;}
.asst-hint-banner .ahb-x{background:none;border:none;color:#6366f1;cursor:pointer;font-size:15px;}
@media(max-width:900px){.asst-panel:not(.asst-floating){width:100%;max-width:none;position:static;}}
/* Assistent — System-Foto-Avatar + freie Platzierung (Drag) */
.asst-hd{cursor:move;}
.asst-ic-img{width:26px;height:26px;border-radius:50%;object-fit:cover;flex:0 0 auto;}
.asst-reset{margin-left:auto;background:none;border:1px solid var(--line,#e3e8ee);border-radius:5px;width:26px;height:26px;cursor:pointer;color:#6b7785;line-height:1;}
.asst-panel.asst-floating{position:fixed;z-index:1000;box-shadow:0 8px 28px rgba(0,0,0,.18);}
/* Assistent — Chooser als Modal-Overlay (lädt assistent.php?…&modal=1) */
.asst-modal-bd{position:fixed;inset:0;z-index:10000;display:none;align-items:flex-start;justify-content:center;
  padding:40px 16px;background:rgba(15,23,42,.55);overflow-y:auto;}
.asst-modal-bd[data-open="1"]{display:flex;}
.asst-modal{position:relative;background:var(--card,#fff);color:var(--fg,#1f2937);width:100%;max-width:560px;
  border-radius:12px;box-shadow:0 24px 60px -15px rgba(0,0,0,.5);padding:22px 24px 18px;}
.asst-modal-x{position:absolute;top:12px;right:12px;background:none;border:1px solid var(--line,#e3e8ee);
  border-radius:6px;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;color:#6b7785;}
.asst-modal-x:hover{border-color:#e6b4ae;color:#b42318;background:#fbecea;}
.asst-chooser-h{display:flex;align-items:center;gap:10px;}
.asst-chooser-av{width:40px;height:40px;border-radius:50%;object-fit:cover;flex:0 0 auto;}
.asst-modal-body .asst-chooser-h{font-size:18px;margin:0 30px 4px 0;}
.asst-modal-body .asst-chooser-av{width:34px;height:34px;}
.asst-modal-body h1{font-size:18px;}

/* Projektansicht — Phasen-Fortschritt-Cockpit */
.proj-cockpit { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 16px; font-size:12px; }
.proj-cockpit-label { color:var(--fg-muted); font-weight:600; }
.proj-cockpit-phase { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:14px;
    background:var(--bg-card); border:1px solid var(--border); color:var(--fg); }
.proj-cockpit-phase.is-empty { color:var(--fg-muted); opacity:.55; }
.proj-cockpit-phase .pcp-count { min-width:16px; text-align:center; background:var(--primary); color:#fff;
    border-radius:9px; padding:0 6px; font-weight:700; font-size:11px; }

/* Projektansicht — Kartenkopf entschlackt (2026-06-19) */
.lvg-summary-stats { font-size:11.5px; color:var(--fg-muted); font-weight:400; }
.lvg-actions { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:8px 0 10px; padding-bottom:10px; border-bottom:1px solid var(--border); }
.lvg-actions .btn { margin:0; }

/* ── Feld-Hilfe-Panel der K-Blatt-Editoren (kalk_help_panel.php) ───────────── */
.kalk-edit-layout { display:flex; gap:24px; align-items:flex-start; }
.kalk-edit-form { min-width:0; flex:1 1 auto; }
.kalk-help { flex:0 0 340px; align-self:stretch; border:1px solid var(--border); border-radius:10px; padding:12px 14px; background:rgba(127,127,127,.06); color:var(--fg); font-size:13px; }
.kalk-help-title { margin:0 0 2px; font-size:15px; }
.kalk-help-sub { margin:0 0 10px; color:var(--fg-muted); font-size:12px; }
.kalk-help-item { padding:8px 10px; border-radius:8px; border:1px solid transparent; margin-bottom:4px; }
.kalk-help-item.is-active { border-color:var(--border-strong,#cbd5e1); background:rgba(127,127,127,.13); box-shadow:0 1px 4px rgba(0,0,0,.12); }
.kalk-help-label { font-weight:600; color:var(--fg); }
.kalk-help-norm { display:inline-block; margin-left:6px; font-weight:500; font-size:11px; color:var(--fg-muted); background:rgba(127,127,127,.14); border:1px solid var(--border); border-radius:6px; padding:0 6px; }
.kalk-help-text { color:var(--fg-muted); margin:2px 0; }
.kalk-help-bsp { color:var(--fg); }
@media (max-width:900px){ .kalk-edit-layout{flex-direction:column} .kalk-help{flex-basis:auto;width:100%} }
