/* ──────────────────────────────────────────────────────────────────────
   GAEB Kalkulation – App-Styles
   Schlicht, professionell, viel Weißraum.
   ────────────────────────────────────────────────────────────────────── */

:root {
    --c-bg:        #f6f7f9;
    --c-surface:   #ffffff;
    --c-border:    #e3e6ea;
    --c-border-2:  #d6dbe1;
    --c-text:      #2b2b2b;
    --c-muted:     #6b7280;
    /* Bauboost CI – Gold (Pantone 147 / 618) + Grau (Pantone 447) */
    --c-primary:   #796636;  /* Bauboost Gold dunkel */
    --c-primary-2: #5d4f29;  /* Hover: einen Tick dunkler für besseren Kontrast */
    --c-accent:    #C6B465;  /* Bauboost Gold hell – für Akzente / Hover-Highlights */
    --c-brand-gray:#575757;  /* Bauboost Grau – für Sidebar-Footer / Buttons */
    --c-ok:        #1a7f37;
    --c-warn:      #b45309;
    --c-err:       #b91c1c;
    --c-yellow-bg: #fff5d6;
    --c-green-bg:  #e6f4ea;
    --c-red-bg:    #fde2e2;
    --c-blue-bg:   #fbf3df;  /* "info"-Badges in dezentem Gold-Ton */

    --radius: 6px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 4px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px; line-height: 1.5;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--c-text); margin-top: 0; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

code { background: #f0f2f5; padding: 0 .3rem; border-radius: 3px; font-size: .9em; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
button, .btn {
    display: inline-block;
    background: var(--c-primary);
    color: #fff;
    border: 0;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .95rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.2;
}
button:hover, .btn:hover { background: var(--c-primary-2); text-decoration: none; }
button.secondary, .btn.secondary { background: #e9ecef; color: var(--c-text); }
button.secondary:hover, .btn.secondary:hover { background: #dde2e7; }
.btn-small { padding: .3rem .65rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; padding: .65rem 1rem; }
.btn-link {
    background: transparent; color: var(--c-primary);
    padding: .3rem .5rem; font-size: .9rem; border: 0; cursor: pointer;
}
.btn-link:hover { background: transparent; text-decoration: underline; }

/* ── Form-Felder ─────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--c-border-2);
    border-radius: var(--radius);
    font-size: .95rem;
    background: #fff;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(31, 78, 121, .3);
    border-color: var(--c-primary);
}
label { display: block; font-weight: 500; margin-bottom: .2rem; font-size: .9rem; }
.field { margin-bottom: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; }
@media (max-width: 700px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Utilities ───────────────────────────────────────────────────────── */
.muted { color: var(--c-muted); }
.small { font-size: .87rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: #f0f2f5;
    color: var(--c-muted);
}
.badge.ok   { background: var(--c-green-bg);  color: var(--c-ok); }
.badge.err  { background: var(--c-red-bg);    color: var(--c-err); }
.badge.warn { background: var(--c-yellow-bg); color: var(--c-warn); }
.badge.info { background: var(--c-blue-bg);   color: var(--c-primary); }
/* Bedarfs-/Wahl-/Alternativposition: dezent neutral, mit Hover-Tooltip */
.badge.badge-optional {
    background: #eef0f3;
    color: var(--c-muted);
    border: 1px dashed var(--c-border-2);
    margin-left: .35rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
/* Bieter-Pflichteintrag (Modell/Fabrikat/Hersteller selbst auszufüllen).
   Auffälliger als „optional", weil hier echte Bearbeitung nötig ist. */
.badge.badge-bidder {
    background: #fff4d6;
    color: #8a5a00;
    border: 1px solid #f0c878;
    margin-left: .35rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: help;
}
.bidder-fillin-block {
    margin: .5rem 0 .75rem;
    padding: .6rem .8rem;
    background: #fff8e6;
    border-left: 3px solid #f0c878;
    border-radius: var(--radius);
}
.bidder-fillin-block strong { color: #8a5a00; }
.bidder-fillin-block .bidder-fillin-text {
    margin: .35rem 0;
    padding: 0;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: .92em;
    line-height: 1.45;
    white-space: pre-wrap;
    color: #2a2a2a;
}

/* ──────────────────────────────────────────────────────────────────────
   LV-Pagination (Pager + Toolbar)
   ────────────────────────────────────────────────────────────────────── */
.lv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin: .5rem 0 .75rem;
    padding: .5rem .75rem;
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: .9rem;
}
.lv-toolbar form {
    margin: 0;
    display: flex;
    align-items: center;
}
.lv-toolbar label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-weight: 500;
    color: var(--c-muted);
}
.lv-toolbar label > span {
    white-space: nowrap;
}
.lv-toolbar input[type="text"] {
    width: 130px;
    padding: .25rem .5rem;
    font-size: .9rem;
}
.lv-toolbar select {
    padding: .25rem .4rem;
    font-size: .9rem;
}
.pager-jump { margin-right: auto; }

.lv-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: .5rem 0;
    padding: .25rem 0;
}
.lv-pager[data-pager-position="bottom"] {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--c-border);
}
.pager-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem;
    align-items: center;
}
.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 .55rem;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    background: #fff;
    color: var(--c-text);
    text-decoration: none;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
    transition: background .12s, border-color .12s;
    user-select: none;
}
.pager-btn:hover:not(.disabled):not(.current) {
    background: var(--c-bg);
    border-color: var(--c-border-2);
}
.pager-btn.current {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    font-weight: 600;
    cursor: default;
}
.pager-btn.disabled {
    opacity: .35;
    cursor: not-allowed;
    background: #fafbfc;
}
.pager-ellipsis {
    padding: 0 .25rem;
    color: var(--c-muted);
    user-select: none;
}
.pager-info {
    white-space: nowrap;
}

/* ── Setup-Seite (alt) ──────────────────────────────────────────────── */
.setup-page { padding: 2rem 1rem; }
.setup {
    max-width: 880px; margin: 0 auto;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}
table.checks { width: 100%; border-collapse: collapse; }
table.checks th, table.checks td {
    text-align: left; padding: .55rem .75rem;
    border-bottom: 1px solid var(--c-border);
    font-size: .92rem;
}
table.checks th {
    background: #f0f2f5; font-weight: 600; color: var(--c-muted);
    font-size: .8rem; text-transform: uppercase; letter-spacing: .03em;
}
table.checks tr.row-err td { background: #fff7f7; }
table.checks tr.row-err td:nth-child(2) { color: var(--c-err); font-weight: 600; }

/* ── Auth-Seiten ─────────────────────────────────────────────────────── */
.auth-shell {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 2rem 1rem;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}
.auth-card header {
    margin: 0 0 2.5rem;  /* mehr Whitespace zur Anmelden-Headline */
    text-align: center;
}
.auth-card header img.brand-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto .5rem;
}
.auth-card header .brand-tag {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-primary);
    margin-top: .35rem;
}
.auth-card header h1 {
    margin: 0 0 1.25rem;
    font-size: 1.2rem;
    color: var(--c-primary);
}
.auth-card h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--c-text);
}

/* ── App-Layout (eingeloggt) ─────────────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-nav {
    background: #fff;
    border-right: 1px solid var(--c-border);
    padding: 1.25rem 1rem 1rem;
    display: flex; flex-direction: column;
}
.app-brand {
    padding: 1rem .5rem 1.25rem;  /* mehr Whitespace außen rum */
    margin-bottom: .75rem;
    border-bottom: 1px solid var(--c-border);
    /* Flex statt text-align — sonst kann der <a>-Wrapper das block-img
       trotz margin:auto links festkleben, weil <a> per Default inline
       läuft und sich auf die Breite des img streckt. */
    display: flex;
    justify-content: center;
}
.app-brand a {
    display: block;
}
.app-brand img.brand-logo {
    display: block;
    width: 150px;                 /* fixe Breite, statt 100% + max-width */
    height: auto;
}
/* .brand-tag im Sidebar-Layout entfernt — der „AUSSCHREIBUNGS ASSISTENT"-
   Untertext nahm zuviel Platz weg und wirkte redundant. Nur das Logo zählt. */
.nav-list {
    list-style: none; padding: 0; margin: 0; flex-grow: 1;
}
.nav-list li {
    margin: .15rem 0;
}
.nav-list li a {
    display: block;
    padding: .45rem .65rem;
    color: var(--c-text);
    border-radius: var(--radius);
    font-size: .92rem;
}
.nav-list li a:hover {
    background: #f0f2f5; text-decoration: none;
}
.nav-list .nav-section {
    margin-top: 1.25rem;
    padding: .35rem .65rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--c-muted);
    font-size: .72rem;
    font-weight: 600;
}
.nav-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--c-border);
}
.user-info { font-size: .85rem; }
.user-info strong { display: block; }
.ctx-banner {
    background: var(--c-blue-bg);
    border: 1px solid #c7d8ec;
    border-radius: var(--radius);
    padding: .55rem .65rem;
    margin: 0 0 .9rem;
    font-size: .85rem;
}
.ctx-banner small { color: var(--c-muted); }

.app-main {
    padding: 1.5rem 2rem;
    max-width: 1280px;
    width: 100%;
}
.app-footer {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--c-border);
    text-align: center;
    font-size: .82rem;
    color: var(--c-muted);
}
.app-footer a {
    color: var(--c-muted);
    margin: 0 .35rem;
}
.app-footer a:hover { color: var(--c-primary); }
.auth-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .8rem;
    color: var(--c-muted);
}
.auth-footer a {
    color: var(--c-muted);
    margin: 0 .35rem;
}
.auth-footer a:hover { color: var(--c-primary); }
@media (max-width: 800px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-nav { border-right: 0; border-bottom: 1px solid var(--c-border); }
    .app-main { padding: 1rem; }
}

/* ── Page-head ───────────────────────────────────────────────────────── */
.page-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.page-head h1 { margin: 0; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
}
.card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .9rem;
}
.card-head h2 { margin: 0; }

/* ── Tabellen ────────────────────────────────────────────────────────── */
.data-table {
    width: 100%; border-collapse: collapse;
    font-size: .92rem;
}
.data-table th, .data-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--c-border);
    text-align: left;
    vertical-align: top;
}
.data-table th {
    color: var(--c-muted); font-weight: 600;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    background: #fafbfc;
}
.data-table tbody tr:hover { background: #fafbfc; }
.data-table .num { text-align: right; }

/* ── Stammdaten-Live-Suche ───────────────────────────────────────────── */
.stammdaten-search-box {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 .85rem;
    flex-wrap: wrap;
}
.stammdaten-search-box input.stammdaten-search {
    flex: 1 1 240px;
    min-width: 200px;
    max-width: 480px;
    padding: .45rem .7rem;
    border: 1px solid var(--c-border-2);
    border-radius: var(--radius);
    background: #fff;
    font-size: .95rem;
}
.stammdaten-search-box input.stammdaten-search:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(121, 102, 54, .18);
}
.stammdaten-search-box .search-count {
    color: var(--c-muted);
    font-size: .85rem;
    white-space: nowrap;
}

/* ── Preis-Strategie-Card (collapsible) ──────────────────────────────── */
.pricing-strategy-details > summary::-webkit-details-marker { display: none; }
.pricing-strategy-details > summary { user-select: none; }
.pricing-strategy-details[open] > summary .pricing-strategy-toggle {
    transform: rotate(90deg);
}


.pricing-strategy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}
.pricing-strategy-row select.form-select {
    padding: .35rem .65rem;
    border: 1px solid #c4c9d2;
    border-radius: .25rem;
    background: #fff;
    font-size: .95rem;
    min-width: 11rem;
    transition: background-color .4s, box-shadow .15s;
}
.pricing-strategy-row select.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(44, 110, 247, .25);
    border-color: var(--c-primary, #2c6ef7);
}
.pricing-strategy-desc {
    color: #555;
    font-size: .92rem;
    margin-left: .25rem;
}

/* ── News-Card (Major-Updates auf Dashboard) ─────────────────────────── */
.news-card { margin-top: 1.25rem; }
.news-card .card-head h2 { display: inline-flex; align-items: center; gap: .4rem; }
.news-list {
    list-style: none;
    margin: 0;
    padding: 0 .85rem 0 0; /* etwas Platz rechts, damit der Scrollbar nicht den Text überdeckt */
    /* Etwa 3 Einträge sichtbar, der Rest scrollt innerhalb der Box.
       Höhe vom Inhalt abgeleitet (3 × ca. 95px + leichter Puffer). */
    max-height: 320px;
    overflow-y: auto;
    /* Sanfter Indikator am unteren Rand, dass es weitergeht */
    mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent 100%);
    scrollbar-width: thin;
    scrollbar-color: var(--c-border-2) transparent;
}
.news-list::-webkit-scrollbar { width: 6px; }
.news-list::-webkit-scrollbar-track { background: transparent; }
.news-list::-webkit-scrollbar-thumb {
    background: var(--c-border-2);
    border-radius: 3px;
}
.news-list::-webkit-scrollbar-thumb:hover { background: var(--c-muted); }
.news-entry {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: .25rem 1rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--c-border);
}
.news-entry:last-child { border-bottom: 0; }
.news-entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
}
.news-icon { font-size: 1.1rem; line-height: 1; }
.news-date {
    font-variant-numeric: tabular-nums;
    color: var(--c-muted);
    white-space: nowrap;
}
.news-tag {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.news-tag-new       { background: rgba(121, 102, 54, .12);  color: var(--c-primary); }
.news-tag-improved  { background: rgba(198, 180, 101, .25); color: #6b5818; }
.news-tag-fix       { background: var(--c-yellow-bg);       color: var(--c-warn); }
.news-entry-body { min-width: 0; }
.news-title { display: block; margin-bottom: .15rem; color: var(--c-text); }
.news-text { margin: 0; color: var(--c-muted); font-size: .92rem; line-height: 1.45; }
@media (max-width: 720px) {
    .news-entry { grid-template-columns: 1fr; }
}

/* ── Stat-Grid (Dashboard) ───────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .9rem;
}
.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform .08s, box-shadow .12s;
}
a.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}
.stat-value {
    font-size: 1.6rem; font-weight: 600; color: var(--c-primary);
}
.stat-label {
    color: var(--c-muted); font-size: .85rem;
}

/* ── Inline-Form (Stammdaten "neue Zeile") ─────────────────────────── */
.inline-form {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch;
}
.inline-form input, .inline-form select {
    width: auto; flex: 1 1 140px; min-width: 0;
}
.inline-form button {
    flex: 0 0 auto;
}

/* ── Inline-Editing (Tabellen-Inputs) ───────────────────────────────── */
table.data-table.editable td {
    padding: .35rem .45rem;
}
table.data-table .inline-edit {
    width: 100%;
    padding: .3rem .4rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    font-size: .9rem;
}
table.data-table .inline-edit:hover {
    border-color: var(--c-border);
    background: #fafbfc;
}
table.data-table .inline-edit:focus {
    outline: 2px solid rgba(31, 78, 121, .25);
    border-color: var(--c-primary);
    background: #fff;
}
table.data-table .inline-edit.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.data-table .inline-edit.saving {
    background: #fff7d6;
}
table.data-table .inline-edit.saved {
    background: var(--c-green-bg);
    transition: background .8s ease;
}

/* Cost-Lines-Tabelle: Beschreibungs-Spalte deutlich breiter, damit auch
   längere Material-/Lohn-/Geräte-Bezeichnungen lesbar sind. Die anderen
   Spalten (Mengen, Preise) brauchen wenig Platz; die Description darf
   den Rest schlucken. Verhindert das frühere Truncate-Problem
   („Geländer mit Handlauf montier…"). */
.cost-lines-table {
    table-layout: auto;
    width: 100%;
}
.cost-lines-table th:nth-child(3),
.cost-lines-table td:nth-child(3) {
    width: 36%;
    min-width: 280px;
}
.cost-lines-table input[data-field="description"] {
    width: 100%;
    min-width: 100%;
    text-overflow: ellipsis;
}

/* ── Stammdaten-Tabellen: Spalten-Breiten ──────────────────────────────
   Gleiche Logik wie bei den Cost-Lines: Text-Spalten (Bezeichnung,
   Stichwörter, Tätigkeit) bekommen prozentual mehr Platz, damit der
   Inhalt voll lesbar ist. Andere Spalten (Einheit, Preis, Aktion)
   bleiben bei natürlicher Breite. */

/* Materialien-Tabelle: Bezeichnung (1), Lieferant (4), Stichwörter (5) */
#materials-table { table-layout: auto; width: 100%; }
#materials-table th:nth-child(1),
#materials-table td:nth-child(1) { width: 24%; min-width: 220px; }
#materials-table th:nth-child(4),
#materials-table td:nth-child(4) { width: 16%; min-width: 140px; }
#materials-table th:nth-child(5),
#materials-table td:nth-child(5) { width: 28%; min-width: 240px; }

/* Aufwandswerte-Tabelle: Gruppe (1), Tätigkeit (2) */
#labor-table { table-layout: auto; width: 100%; }
#labor-table th:nth-child(1),
#labor-table td:nth-child(1) { width: 18%; min-width: 160px; }
#labor-table th:nth-child(2),
#labor-table td:nth-child(2) { width: 30%; min-width: 240px; }

/* Geräte-Tabelle: Bezeichnung (1), Anbieter (4) */
#equipment-table { table-layout: auto; width: 100%; }
#equipment-table th:nth-child(1),
#equipment-table td:nth-child(1) { width: 30%; min-width: 240px; }
#equipment-table th:nth-child(4),
#equipment-table td:nth-child(4) { width: 18%; min-width: 160px; }

/* Leistungsgruppen-Tabelle: Name (2), Stichwörter (4) */
#service-groups-table { table-layout: auto; width: 100%; }
#service-groups-table th:nth-child(2),
#service-groups-table td:nth-child(2) { width: 22%; min-width: 200px; }
#service-groups-table th:nth-child(4),
#service-groups-table td:nth-child(4) { width: 35%; min-width: 280px; }

/* Inputs der Stammdaten-Tabellen: 100% der Cell-Breite einnehmen
   (Default-inline-edit-CSS oben hat schon width:100%, hier nur sicher
   gehen, dass die ellipsis-Verkürzung nicht zuschlägt). */
#materials-table .inline-edit,
#labor-table .inline-edit,
#equipment-table .inline-edit,
#service-groups-table .inline-edit {
    width: 100%;
    min-width: 0; /* Flexbox-Schutz, falls Browser sonst tausenden Pixel nimmt */
}

/* Aufklappbare Erklärungs-Boxen oben auf den Stammdaten-Seiten.
   Standard-<details>-Marker zeigt Browser-eigenes Dreieck — wir lassen
   das so, weil's vertraut ist und auf den ersten Blick erkennbar
   ankündigt, dass hier was zum Aufklappen ist. */
details.stammdaten-help > summary {
    list-style: revert; /* nutzt Browser-Default-Marker */
    user-select: none;
}
details.stammdaten-help[open] > summary {
    margin-bottom: .25rem;
}
details.stammdaten-help > summary:hover {
    text-decoration: underline;
}
table.data-table .inline-edit.save-error {
    background: var(--c-red-bg);
    border-color: var(--c-err);
}

/* ── Dropzone (PDF-Upload mit Drag & Drop) ─────────────────────────── */
.dropzone {
    position: relative;
    border: 2px dashed var(--c-border-2);
    border-radius: var(--radius);
    background: #fafbfc;
    padding: 0;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--c-primary); background: #f3f7fb; }
.dropzone.is-dragover {
    border-color: var(--c-primary);
    background: var(--c-blue-bg);
    border-style: solid;
}
/* Während ein Upload läuft (JS setzt .is-busy + aria-busy):
   Dropzone ist gedimmt, klick/drag wird sichtbar verweigert. Verhindert
   parallele PDF-Uploads, die jeweils einen separaten Anthropic-Call
   produzieren würden. Hover-Effekt explizit zurücknehmen, damit die
   Sperre auch beim Mouse-Over deutlich bleibt. */
.dropzone.is-busy {
    opacity: .55;
    cursor: not-allowed !important;
    pointer-events: none; /* Drag&Drop-Events blockieren */
    border-style: solid;
    border-color: var(--c-border-2);
    background: #f3f3f3;
}
.dropzone.is-busy:hover {
    border-color: var(--c-border-2);
    background: #f3f3f3;
}
.dropzone input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}
.dropzone-inner {
    padding: 2rem 1.5rem;
    text-align: center;
    pointer-events: none; /* damit nur der äußere Klick zählt */
}
.dropzone-inner button { pointer-events: auto; }
.dropzone-icon { font-size: 2.4rem; margin-bottom: .5rem; opacity: .6; }
.dropzone-text { margin: 0 0 .35rem; font-size: 1rem; }
.dropzone-text strong { color: var(--c-primary); }
.dropzone-inner .btn-link { font-size: 1rem; padding: 0; }

/* Indeterminate-Animation für unbekannten Fortschritt (KI-Analyse) */
.progress-bar.indeterminate {
    background: linear-gradient(
        90deg,
        var(--c-primary) 0%,
        var(--c-primary-2) 30%,
        var(--c-primary) 60%,
        var(--c-primary-2) 100%
    );
    background-size: 200% 100%;
    animation: indeterminateMove 1.4s linear infinite;
}
@keyframes indeterminateMove {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ── Fortschrittsbalken (Batch-Verarbeitung) ───────────────────────── */
.progress-panel {
    border-left: 4px solid var(--c-primary);
}
.progress-bar-wrap {
    width: 100%;
    background: #eef0f3;
    border-radius: 999px;
    overflow: hidden;
    height: 14px;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--c-primary), var(--c-primary-2));
    transition: width .3s ease;
    border-radius: 999px;
}

/* ── Status-Zeile unter dem Projekt-Titel ──────────────────────────── */
.status-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .35rem;
    flex-wrap: wrap;
}
.status-row .btn-link {
    font-size: .82rem;
    color: var(--c-muted);
    padding: .15rem .4rem;
}
.status-row .btn-link:hover {
    color: var(--c-primary);
    background: #f0f2f5;
    border-radius: 3px;
    text-decoration: none;
}

/* ── Inline-Edit Projekt-Titel (Stift) ─────────────────────────────── */
.project-title-wrap {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    flex-wrap: wrap;
}
.project-title-display {
    cursor: text;
}
.project-title-display:hover {
    background: linear-gradient(transparent 75%, rgba(31, 78, 121, .12) 75%);
    border-radius: 3px;
    padding: 0 .15rem;
    margin: 0 -.15rem;
}
.project-title-input {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.15;
    padding: .15rem .45rem;
    border: 2px solid var(--c-primary);
    border-radius: var(--radius);
    width: auto;
    min-width: 280px;
    max-width: 100%;
    background: #fff;
    color: var(--c-text);
    font-family: inherit;
}
.title-edit-btn {
    background: transparent;
    color: var(--c-muted);
    padding: .15rem .4rem;
    font-size: .9rem;
    border: 0;
    border-radius: 4px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease;
}
.project-title-wrap:hover .title-edit-btn,
.title-edit-btn:focus { opacity: 1; }
.title-edit-btn:hover {
    background: #f0f2f5;
    color: var(--c-primary);
}
.project-title-wrap.saving .project-title-input { opacity: .55; }
.project-title-wrap.saved .project-title-display {
    animation: titleSaved 1.2s ease-out;
}
@keyframes titleSaved {
    0%   { background-color: #b9e6c5; }
    100% { background-color: transparent; }
}

/* ── PDF-Import Review-Tabelle ─────────────────────────────────────── */
table.review-table {
    font-size: .9rem;
}
table.review-table th {
    font-size: .72rem;
    padding: .5rem .35rem;
}
table.review-table td {
    padding: .35rem;
    vertical-align: top;
}
table.review-table input {
    width: 100%;
    padding: .35rem .5rem;
    font-size: .88rem;
    box-sizing: border-box;
}
table.review-table input.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
/* Bestehender Eintrag → leicht ausgegraut, Default-Häkchen aus */
table.review-table tr.row-exists td {
    background: #fafbfc;
}
table.review-table tr.row-exists input[type="text"],
table.review-table tr.row-exists input[type="number"],
table.review-table tr.row-exists input:not([type]) {
    color: var(--c-muted);
}

/* ── Audit-Log Filter-Form ─────────────────────────────────────────── */
form.audit-filter {
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 0.9fr 0.9fr auto;
    gap: .75rem 1rem;
    align-items: end;
}
form.audit-filter .field { margin-bottom: 0; }
form.audit-filter button + .btn { margin-left: .5rem; }
@media (max-width: 800px) {
    form.audit-filter { grid-template-columns: 1fr 1fr; }
}

/* Audit-Log: lange Filenames / Tokens in der Details-Spalte umbrechen.
   Ohne diese Regeln sprengt ein einzelner Underscore-String (z.B.
   "Angebot_2026-05-001_BSR_018_Metallbauarbeiten_LV_15082023.pdf") die
   ganze Tabelle, weil der Browser bei `_` per Default nicht trennt und
   die Auto-Layout-Engine die Spalte content-getrieben aufbläst. */
.data-table td.audit-details {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Wizard: Schritt-Indikator + Footer ────────────────────────────── */
.wizard-steps {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: .65rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.wizard-steps ol {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-wrap: wrap;
    gap: .25rem;
    align-items: center;
}
.wizard-steps .step {
    padding: .3rem .85rem;
    border-radius: 999px;
    font-size: .88rem;
    color: var(--c-muted);
    background: #f0f2f5;
}
.wizard-steps .step a, .wizard-steps .step span { color: inherit; text-decoration: none; }
.wizard-steps .step + .step::before {
    content: "→";
    color: var(--c-muted);
    margin-right: .25rem;
    margin-left: -.5rem;
    padding-right: .35rem;
}
.wizard-steps .step-active  { background: var(--c-primary); color: #fff; font-weight: 600; }
.wizard-steps .step-done    { background: var(--c-green-bg); color: var(--c-ok); }
.wizard-steps .step-done a:hover { text-decoration: underline; }
.wizard-steps .step-pending { opacity: .55; }

.wizard-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; gap: .75rem;
}

/* ── Verweis-Hinweis (z.B. "wie Pos. 01.0010") ─────────────────────── */
.ref-hint {
    background: #fff7d6;
    border: 1px solid #f0c674;
    border-left: 4px solid var(--c-warn);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    margin: .5rem 0 .75rem;
    font-size: .9rem;
    color: var(--c-text);
}
.ref-hint a {
    display: inline-block;
    margin: 0 .15rem;
    padding: 0 .3rem;
    background: #fff;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 600;
}
.ref-hint a:hover { text-decoration: underline; }

/* ── Langtext-Block (Position aufgeklappt, Baubeschreibung) ───────── */
.longtext-block { margin: .5rem 0 1rem; }
.longtext-block summary {
    cursor: pointer;
    color: var(--c-primary);
    font-size: .85rem;
    padding: .25rem 0;
    user-select: none;
}
.longtext-block summary:hover { text-decoration: underline; }
pre.longtext {
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: .75rem 1rem;
    margin: .5rem 0 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: .88rem;
    line-height: 1.45;
    color: var(--c-text);
    max-height: 480px;
    overflow-y: auto;
}

/* Editierbarer Langtext (ersetzt das alte Read-Only-<pre>) */
.longtext-editor { margin: .5rem 0 0; }
textarea.longtext-edit {
    width: 100%;
    box-sizing: border-box;
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: .75rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: .88rem;
    line-height: 1.45;
    color: var(--c-text);
    resize: vertical;
    min-height: 6rem;
    overflow: hidden; /* Auto-Resize via JS — kein interner Scrollbalken */
}
textarea.longtext-edit:focus {
    outline: none;
    border-color: var(--c-primary);
    background: #fff;
}
.longtext-edit-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .5rem;
}
.longtext-edit-toolbar .btn-sm {
    padding: .35rem .9rem;
    font-size: .82rem;
}
.longtext-edit-status { font-size: .8rem; }

/* ── LV-Position: Status-Indikator ──────────────────────────────────
   Konzept: alle "fertig kalkulierten" Positionen (egal ob Stammdaten,
   KI oder manuell) bekommen eine einheitliche grüne Tönung + grünen Balken.
   Rote Positionen ("muss noch") bleiben neutral und stechen so hervor.
*/
tr.pos-row > td:first-child {
    border-left: 4px solid transparent;
}
/*
   Zwei Stufen:
     1. Nur „gematched" (Status grün/gelb gesetzt, KI war noch nicht dran):
        Zeile bleibt komplett WEISS — Status-Badge (gelb/rot) zeigt den
        Vorab-Match-Status an, das reicht. Sonst wirken Zeilen vor der
        KI-Schätzung fälschlich „fertig grün".
     2. Tatsächlich kalkuliert (.is-calculated, gesetzt sobald KI gelaufen
        ist bzw. die Position vollständig aus Stammdaten kommt): kräftige
        Stripe + dezente Hintergrund-Tönung — signalisiert „Position fertig".
   So sieht der User auf einen Blick, was noch durch die KI muss.
   Nur error/manual zeigen schon vor Kalkulation eine farbige Markierung,
   weil sie vom User aktiv bearbeitet werden müssen.
*/
tr.pos-row.status-red       > td:first-child { border-left-color: #e88; }
/* status-manual: User-Zuweisung – orange Markierung */
tr.pos-row.status-manual    > td:first-child { border-left-color: #f0a040; }
/* status-error: KI-Fehler – kräftiges Rot, stärker als reiner red */
tr.pos-row.status-error     > td:first-child { border-left-color: #d84040; }

/* Wenn tatsächlich kalkuliert: kräftige Stripe + Tönung */
tr.pos-row.status-yellow.is-calculated  > td:first-child,
tr.pos-row.status-green.is-calculated   > td:first-child,
tr.pos-row.status-ki_only.is-calculated > td:first-child {
    border-left-color: #4a9362;
}
tr.pos-row.status-yellow.is-calculated  > td,
tr.pos-row.status-green.is-calculated   > td,
tr.pos-row.status-ki_only.is-calculated > td { background-color: rgba(74, 147, 98, .10); }

/* status-manual: dezente orange Tönung – „User hat zugewiesen, ggf. prüfen" */
tr.pos-row.status-manual    > td { background-color: rgba(240, 160, 64, .10); }
/* status-error: deutlichere rote Tönung – „KI ist gescheitert, hier muss was passieren" */
tr.pos-row.status-error     > td { background-color: rgba(216, 64, 64, .12); }
/* status-red: keine Tönung – sticht als "noch zu tun" heraus */

/* ── Info-only Zeilen (Section-Header / Hinweistexte aus X83) ──────────
   Strukturelle LV-Elemente, die NICHT kalkuliert werden, aber in der
   Tabelle inline mit den Positionen stehen, damit das LV in seiner
   Original-Gliederung sichtbar bleibt. */
tr.info-only > td {
    background-color: #f1f3f6;
    border-top: 2px solid var(--c-border);
}
tr.info-only.info-section > td {
    /* Untertitel als deutliche Zwischenüberschrift */
    background-color: #e8eef5;
    color: var(--c-text);
    font-weight: 600;
    font-size: .98rem;
    padding-top: .85rem;
    padding-bottom: .55rem;
}
tr.info-only.info-hint > td {
    /* Hinweistexte: dezenter, mit linker Akzent-Leiste. Inhalt ist als
       <details>-Block aufklappbar — Italic-Style nur in der Summary, im
       aufgeklappten Volltext wieder normal. */
    border-left: 3px solid #b8c2d1;
    color: var(--c-muted);
    padding: .55rem 1rem;
}
tr.info-only .info-text {
    white-space: pre-wrap;
    line-height: 1.45;
}
.info-hint-details > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: .15rem 0;
}
.info-hint-details > summary::-webkit-details-marker { display: none; }
.info-hint-details > summary:hover {
    color: var(--c-text);
}
.info-hint-details[open] > summary {
    border-bottom: 1px dashed var(--c-border);
    padding-bottom: .35rem;
    margin-bottom: .25rem;
}

/* Aufklapp-Button: dreht sich, wenn die Zeile geöffnet ist.
   Generisch auf jede Zeile mit .open — funktioniert dann auch auf der
   Matching-Seite, wo der Wrapper tr nicht .pos-row sondern .match-row heißt. */
.toggle-btn {
    display: inline-block;
    transition: transform .2s ease-in-out;
    font-size: 1rem;
    line-height: 1;
}
tr.open .toggle-btn {
    transform: rotate(180deg);
}

/* ── Live-Highlight für gerade fertig kalkulierte LV-Zeilen ────────── */
tr.pos-row.just-estimated > td {
    /* startet hellgrün, fadet über 2.4s zurück */
    animation: justEstimated 2.4s ease-out;
}
@keyframes justEstimated {
    0%   { background-color: #b9e6c5; }   /* sattes Hellgrün am Anfang */
    25%  { background-color: #d6f1de; }
    100% { background-color: transparent; }
}

/* ── Aufklappbare Detail-Zeilen (Projekt-Show) ─────────────────────── */
tr.cost-detail { display: none; background: #fafbfc; }
tr.cost-detail.open { display: table-row; }
tr.cost-detail > td { padding: .5rem 1rem 1rem; }

tr.costline-material td { background: rgba(26, 127, 55, .04); }
tr.costline-labor    td { background: rgba(180, 83, 9,  .04); }
tr.costline-equipment td{ background: rgba(31, 78, 121, .04); }
tr.costline-markup   td { background: rgba(126, 34, 206, .05); }

/* ── Flash-Messages ─────────────────────────────────────────────────── */
.flash {
    padding: .65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .92rem;
    line-height: 1.5;
    border: 1px solid transparent;
    /* `pre-line` kollabiert mehrfache Whitespaces zu einem (wie normales
       HTML) — wichtig, weil das Layout-Template aus Lesbarkeits-Gründen
       eingerückt wird und sonst die Indentation als sichtbarer Leerraum
       VOR dem Flash-Text gerendert würde. Newlines bleiben aber erhalten,
       damit mehrzeilige Flashes (z.B. „Setup-Link\n\n...") weiterhin
       korrekt umbrechen. */
    white-space: pre-line;
    /* `overflow-wrap: break-word` greift NUR bei wirklich unbreakable
       Strings (z.B. lange URLs ohne Whitespace). Vorher stand hier
       `word-break: break-word`, das aggressiver ist und auch Wörter mit
       Bindestrichen wie „E-Mail" mitten im Wort umgebrochen hat — sah
       in schmalen Boxen wie der Login-Card hässlich aus. */
    overflow-wrap: break-word;
    word-break: normal;
}
.flash-success { background: var(--c-green-bg);  color: var(--c-ok);   border-color: #b8dcc1; }
.flash-error   { background: var(--c-red-bg);    color: var(--c-err);  border-color: #f4bcbc; }
.flash-warning { background: var(--c-yellow-bg); color: var(--c-warn); border-color: #f0c674; }
.flash-info    { background: var(--c-blue-bg);   color: var(--c-primary); border-color: #c7d8ec; }

/* ──────────────────────────────────────────────────────────────────────
   Dashboard Split-Layout: links Aktions-/Projekt-Stack, rechts Cross-Sell
   ────────────────────────────────────────────────────────────────────── */
.dashboard-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
    /* `align-items: start` statt `stretch`: jede Spalte behält ihre
       natürliche Höhe. Vorher hat das stretch zusammen mit `flex: 1` auf
       der rechten Card dafür gesorgt, dass die Cross-Sell-Box auf die
       volle Höhe der linken Spalte gezogen wurde — bei vielen Projekten
       entstand dadurch viel Leerraum unter dem Angebot. */
    align-items: start;
}
.dashboard-split.is-single {
    /* Wenn keine Cross-Sell-Angebote da sind, fällt der Stack auf 1 Spalte */
    grid-template-columns: 1fr;
}
.dashboard-split-left {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.dashboard-split-right {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
@media (max-width: 980px) {
    .dashboard-split {
        grid-template-columns: 1fr;
    }
}

/* ──────────────────────────────────────────────────────────────────────
   „Letzte Projekte"-Tabelle auf dem Dashboard
   Lange Projekt-Namen abschneiden statt das Layout zu sprengen, und
   den Auftragswert nicht umbrechen (das „€" bleibt am Betrag).
   ────────────────────────────────────────────────────────────────────── */
.dashboard-split-left .data-table {
    table-layout: fixed;
    width: 100%;
}
.recent-projects-name {
    /* Ellipsis-Truncation auf Zellen-Ebene: greift unabhängig von der
       PHP-seitigen Hartkappe und passt sich der tatsächlichen Spalten-
       breite an. */
    max-width: 1px; /* table-layout: fixed nimmt sich die übrige Breite */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-projects-name a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.dashboard-split-left .data-table .num {
    /* „24.542.483,02 €" darf nicht zwischen Betrag und € umbrechen. */
    white-space: nowrap;
}

/* ──────────────────────────────────────────────────────────────────────
   Cross-Selling-Gallery auf dem Dashboard
   Ein Angebot sichtbar, Pfeile + Punkt-Indikator + Swipe-Geste.
   ────────────────────────────────────────────────────────────────────── */
.cross-sell-gallery {
    position: relative;
    margin-top: .25rem;
}
.cross-sell-viewport {
    overflow: hidden;
    border-radius: var(--radius);
}
.cross-sell-track {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    transition: transform .35s cubic-bezier(.4, .15, .2, 1);
    will-change: transform;
}
.cross-sell-track.is-dragging {
    transition: none;
}
.cross-sell-slide {
    flex: 0 0 100%;
    min-width: 100%;
    /* Flex-Item soll nicht horizontal "schrumpfen" wegen langer Texte */
    box-sizing: border-box;
}
.cross-sell-arrow {
    position: absolute;
    top: 90px; /* mittig auf dem Bild (Bild ist 180px hoch) */
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--c-border);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(4px);
    color: var(--c-text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    transition: background .15s, transform .12s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 0;
}
.cross-sell-arrow:hover {
    background: #fff;
    transform: scale(1.05);
}
.cross-sell-arrow:active {
    transform: scale(.95);
}
.cross-sell-arrow:disabled {
    opacity: 0;
    pointer-events: none;
}
.cross-sell-prev { left: .6rem; }
.cross-sell-next { right: .6rem; }

.cross-sell-dots {
    display: flex;
    justify-content: center;
    gap: .4rem;
    margin-top: .85rem;
}
.cross-sell-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    background: var(--c-border-2);
    cursor: pointer;
    transition: background .15s, transform .15s;
}
.cross-sell-dot:hover {
    background: var(--c-muted);
}
.cross-sell-dot.is-active {
    background: var(--c-primary);
    transform: scale(1.3);
}

/* Admin-Formular für Cross-Sell-Angebote */
.stacked-form > label,
.stacked-form > fieldset {
    display: block;
    margin-bottom: 1rem;
}
.stacked-form label > span {
    display: block;
    margin-bottom: .25rem;
    font-weight: 500;
    font-size: .9rem;
}
.stacked-form label > span em {
    color: var(--c-err);
    font-style: normal;
}
.stacked-form .grid-2 > label {
    display: block;
    margin-bottom: 1rem;
}
.stacked-form fieldset {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    background: #fafbfc;
}
.stacked-form fieldset legend {
    padding: 0 .4rem;
    font-weight: 500;
    font-size: .92rem;
    color: var(--c-muted);
}
.stacked-form .inline-checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .5rem 0;
    font-weight: normal;
    font-size: .92rem;
}
.stacked-form .inline-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.stacked-form .form-actions {
    display: flex;
    gap: .6rem;
    margin-top: 1.25rem;
}
.cross-sell-current-image img {
    max-width: 360px;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
}
.image-spec-hint {
    background: var(--c-blue-bg);
    border: 1px solid #d8c989;
    border-radius: var(--radius);
    padding: .65rem .85rem;
    margin-bottom: .9rem;
    line-height: 1.5;
}
.image-spec-hint strong {
    color: var(--c-text);
}

/* ──────────────────────────────────────────────────────────────────────
   FAQ-Akkordeon im Hilfe-Bereich
   ────────────────────────────────────────────────────────────────────── */
.faq-section h2 {
    margin: 0 0 1rem;
}
.faq-item {
    border-top: 1px solid var(--c-border);
    padding: .5rem 0;
}
.faq-item:first-of-type {
    border-top: 0;
}
.faq-item summary {
    cursor: pointer;
    padding: .5rem 0;
    user-select: none;
    list-style: none;
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.45;
    color: var(--c-text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
    content: "▸";
    position: absolute;
    left: 0;
    top: .55rem;
    font-size: .85rem;
    color: var(--c-primary);
    transition: transform .15s ease;
    transform-origin: center;
}
.faq-item[open] summary::before {
    transform: rotate(90deg);
}
.faq-item summary:hover {
    color: var(--c-primary);
}
.faq-body {
    padding: .25rem 0 .85rem 1.5rem;
    line-height: 1.6;
    color: var(--c-text);
}
.faq-body p:first-child { margin-top: 0; }
.faq-body p:last-child  { margin-bottom: 0; }
.faq-body ul, .faq-body ol {
    margin: .5rem 0;
    padding-left: 1.4rem;
}
.faq-body code {
    background: var(--c-bg);
    padding: .1rem .35rem;
    border-radius: 3px;
    font-size: .92em;
}

/* Während live laufender (oder pausierter) KI-Schätzung blenden wir die
   destruktiven Action-Buttons (Kalkulation zurücksetzen, KI-Schätzung neu
   starten, Excel-Export) komplett aus. Klick auf eines dieser drei Elemente
   würde den laufenden Batch verfälschen oder eine inkonsistente Datei
   exportieren. Der User soll während des Laufs nur Pause / Fortsetzen /
   Abbrechen sehen — alles andere ist erst wieder sinnvoll, wenn der Batch
   abgeschlossen ist (dann entfernt finishBatch() die body-Klasse wieder).
   Navigation auf andere Seiten bleibt erlaubt: der Worker läuft serverseitig
   weiter, autoResumeBatchIfRunning() nimmt das Polling beim Wiederkehren
   automatisch auf. */
body.is-calculating .nav-blocked-during-batch {
    display: none !important;
}
/* Pause/Fortsetzen-Paar: das jeweils inaktive Element bleibt sichtbar, ist
   aber deutlich gedimmt und nicht klickbar. Damit ist immer klar, welche
   Aktion gerade möglich ist und welche „die andere Seite" wäre. */
.estimate-action-pair button[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

/* ──────────────────────────────────────────────────────────────────────
   Modal-Dialog (bbConfirm / bbAlert) im Bauboost-Look
   Ersetzt die nativen Browser-confirm/alert-Boxen.
   ────────────────────────────────────────────────────────────────────── */
.bb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 26, .55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: bb-overlay-in .14s ease-out;
}
.bb-modal-overlay.is-closing {
    animation: bb-overlay-out .12s ease-in forwards;
}
.bb-modal {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    max-width: 480px;
    width: 100%;
    padding: 1.25rem 1.5rem 1.1rem;
    animation: bb-modal-in .16s cubic-bezier(.2, .9, .3, 1.1);
}
.bb-modal-title {
    margin: 0 0 .55rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--c-text);
}
.bb-modal-message {
    margin: 0;
    color: var(--c-text);
    font-size: .94rem;
    line-height: 1.55;
    white-space: pre-wrap; /* damit \n im Text als echte Zeilenumbrüche erscheinen */
}
.bb-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .55rem;
    margin-top: 1.25rem;
}
.bb-modal.is-danger [data-action="confirm"] {
    background: var(--c-err);
    border-color: var(--c-err);
}
.bb-modal.is-danger [data-action="confirm"]:hover {
    background: #9d1818;
    border-color: #9d1818;
}
@keyframes bb-overlay-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes bb-overlay-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes bb-modal-in {
    from { opacity: 0; transform: translateY(-8px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .bb-modal-overlay, .bb-modal { animation: none; }
}

/* ──────────────────────────────────────────────────────────────────────
   KI-Disclaimer Dialog (HTML5 <dialog>) — Hinweis nach KI-Kalkulation
   Eigene Optik mit dem warmen Warnton (gelbliches Beige), damit der
   User den Hinweis sofort als „Achtung, KI-geschätzt" wahrnimmt. Der
   native ::backdrop wird auf das gleiche Dunkelgrau wie bei bbConfirm
   gelegt, damit beide Modal-Typen gleich „schwer" wirken.
   ────────────────────────────────────────────────────────────────────── */
.ki-disclaimer-dialog {
    border: 1px solid #e0c78f;
    border-left: 4px solid #f0c878;
    border-radius: var(--radius);
    background: #fff8e6;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    max-width: 560px;
    width: calc(100% - 2rem);
    padding: 0;
    color: var(--c-text);
}
.ki-disclaimer-dialog::backdrop {
    background: rgba(20, 22, 26, .55);
}
.ki-disclaimer-content {
    padding: 1.4rem 1.6rem 1.15rem;
    line-height: 1.55;
}
.ki-disclaimer-content h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 .75rem;
}
.ki-disclaimer-content p {
    margin: 0 0 .75rem;
    font-size: .94rem;
}
.ki-disclaimer-content p:last-of-type {
    margin-bottom: 0;
}
.ki-disclaimer-dialog[open] {
    animation: bb-modal-in .16s cubic-bezier(.2, .9, .3, 1.1);
}
@media (prefers-reduced-motion: reduce) {
    .ki-disclaimer-dialog[open] { animation: none; }
}

.cross-sell-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative; /* damit das ANGEBOT-Badge absolut platziert werden kann */
    transition: transform .1s ease, box-shadow .12s ease;
}
.cross-sell-badge {
    position: absolute;
    top: .75rem;
    left: .75rem;
    z-index: 2;
    background: var(--c-primary);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: .25rem .55rem;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    pointer-events: none; /* keine Interaktions-Behinderung des Bild-Links darunter */
}
.cross-sell-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}
.cross-sell-image-link {
    display: block;
    line-height: 0;
    background: var(--c-bg);
}
.cross-sell-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.cross-sell-body {
    padding: 1rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    flex: 1;
}
.cross-sell-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--c-text);
}
.cross-sell-text {
    margin: 0;
    font-size: .92rem;
    color: var(--c-muted);
    line-height: 1.45;
    flex: 1;
}
.cross-sell-cta {
    align-self: flex-start;
    margin-top: .35rem;
}

/* Detailseite eines Cross-Sell-Angebots */
.cross-sell-detail-card {
    max-width: 760px;
}
.cross-sell-detail-image {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.cross-sell-detail-body {
    margin: 1rem 0 1.25rem;
    line-height: 1.55;
}
.cross-sell-detail-cta {
    margin-top: 1.25rem;
}

/* ──────────────────────────────────────────────────────────────────────
   Welcome-Modal (Erst-Login Onboarding)
   HTML5 <dialog>-Element. Wird einmal pro User gezeigt, dann via DB-Flag
   `users.welcome_dismissed_at` dauerhaft unterdrückt.
   ────────────────────────────────────────────────────────────────────── */
.welcome-modal {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    max-width: 600px;
    width: calc(100% - 2rem);
    padding: 0;
    color: var(--c-text);
}
.welcome-modal::backdrop {
    background: rgba(20, 22, 26, .55);
}
.welcome-modal[open] {
    animation: bb-modal-in .18s cubic-bezier(.2, .9, .3, 1.1);
}
.welcome-modal-content {
    padding: 1.6rem 1.75rem 1.4rem;
    line-height: 1.55;
}
.welcome-modal-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
}
.welcome-steps {
    margin: 1rem 0;
    padding-left: 1.25rem;
    line-height: 1.6;
}
.welcome-steps li {
    margin-bottom: .65rem;
}
.welcome-steps li:last-child {
    margin-bottom: 0;
}
.welcome-modal-actions {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
}
.welcome-modal-actions .btn-link {
    background: transparent;
    border: 0;
    color: var(--c-muted);
    cursor: pointer;
    padding: .5rem .25rem;
    font: inherit;
    font-size: .9rem;
    text-decoration: underline;
}
.welcome-modal-actions .btn-link:hover {
    color: var(--c-text);
}
@media (prefers-reduced-motion: reduce) {
    .welcome-modal[open] { animation: none; }
}

/* ──────────────────────────────────────────────────────────────────────
   Help-Chat (Floating Bubble + Panel)
   KI-Bot, der bei Bedarf an einen Menschen eskaliert. Eingebunden im
   Layout für eingeloggte User. Bewusst minimal — keine Animations-
   Spielereien, kein Custom-Scrollbar-Look. Soll sich „mitschwimmend"
   anfühlen, nicht aufdringlich.
   ────────────────────────────────────────────────────────────────────── */
.help-chat-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    border: 0;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    transition: background .12s ease, transform .12s ease;
}
.help-chat-launcher:hover {
    background: var(--c-primary-2);
    transform: translateY(-1px);
}
.help-chat-launcher svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}
.help-chat-launcher.is-open {
    /* Wenn das Panel offen ist, blenden wir den Launcher aus, statt ein
       weiteres Element auf dem Schirm zu lassen. Das Panel hat einen
       eigenen Schließen-X. */
    display: none;
}

.help-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 380px;
    max-width: calc(100vw - 2.5rem);
    height: 560px;
    max-height: calc(100vh - 2.5rem);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1201;
}
.help-chat-panel.is-open {
    display: flex;
}

.help-chat-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    background: var(--c-primary);
    color: #fff;
}
.help-chat-head .help-chat-title {
    flex: 1;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .01em;
}
.help-chat-head .help-chat-subtitle {
    flex: 1;
    font-size: .75rem;
    opacity: .85;
    margin-top: 1px;
}
.help-chat-head-icon-btn {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    padding: .25rem .35rem;
    border-radius: 4px;
    line-height: 1;
    font-size: 1.1rem;
}
.help-chat-head-icon-btn:hover {
    background: rgba(255, 255, 255, .15);
}

.help-chat-menu {
    position: absolute;
    top: 48px;
    right: .75rem;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
    padding: .25rem 0;
    min-width: 200px;
    z-index: 5;
    display: none;
}
.help-chat-menu.is-open {
    display: block;
}
.help-chat-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: .55rem .85rem;
    font-size: .9rem;
    color: var(--c-text);
    cursor: pointer;
}
.help-chat-menu button:hover {
    background: var(--c-bg);
}
.help-chat-menu button.danger {
    color: var(--c-err);
}

.help-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.help-chat-msg {
    max-width: 85%;
    padding: .55rem .75rem;
    border-radius: 10px;
    font-size: .9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.help-chat-msg.role-assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--c-border);
    color: var(--c-text);
    border-bottom-left-radius: 2px;
}
.help-chat-msg.role-user {
    align-self: flex-end;
    background: var(--c-primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}
.help-chat-msg .help-chat-msg-time {
    display: block;
    font-size: .7rem;
    opacity: .6;
    margin-top: .25rem;
}
.help-chat-empty {
    color: var(--c-muted);
    font-size: .88rem;
    text-align: center;
    padding: 2rem 1rem;
    line-height: 1.55;
}
.help-chat-typing {
    align-self: flex-start;
    color: var(--c-muted);
    font-size: .85rem;
    font-style: italic;
    padding: .25rem .25rem;
}

.help-chat-foot {
    border-top: 1px solid var(--c-border);
    background: #fff;
    padding: .6rem .75rem;
    display: flex;
    gap: .4rem;
    align-items: flex-end;
}
.help-chat-input {
    flex: 1;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: .55rem .65rem;
    font: inherit;
    font-size: .9rem;
    resize: none;
    max-height: 120px;
    min-height: 38px;
    line-height: 1.4;
    background: var(--c-surface);
}
.help-chat-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(121, 102, 54, .15);
}
.help-chat-send {
    background: var(--c-primary);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 0 .9rem;
    height: 38px;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
}
.help-chat-send:hover { background: var(--c-primary-2); }
.help-chat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Auf schmalen Screens: Panel füllt fast den ganzen Viewport. */
@media (max-width: 480px) {
    .help-chat-panel {
        width: calc(100vw - 1rem);
        height: calc(100vh - 1rem);
        right: .5rem;
        bottom: .5rem;
        border-radius: 8px;
    }
    .help-chat-launcher {
        right: .75rem;
        bottom: .75rem;
    }
}
