/* VERA - Grundgeruest der Oberflaeche.
   Diese Datei kennt keine Marke. Farben, Schriften und Formen kommen als
   CSS-Variablen aus dem Theme (static/themes/<name>/theme.css), das nach
   dieser Datei geladen wird und die Werte hier ueberschreibt. Die Werte
   unten sind nur ein neutraler Rueckfall. */

:root {
    --primary: #2b6cb0;
    --primary-dark: #1f4f82;
    --primary-soft: #e3edf8;
    --primary-tint: #f2f7fc;
    --primary-ring: rgba(43, 108, 176, 0.18);
    --ink: #111827;
    --text: #1b2430;
    --muted: #6b7280;
    --border: #e3e6ea;
    --border-strong: #cbd2da;
    --bg: #f4f5f7;
    --card: #ffffff;
    --accent: #d99a06;
    --accent-soft: #fff6e0;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --warning-soft: #fff6e0;
    --info-soft: #eaf3fb;
    --topbar-bg: #ffffff;
    --topbar-text: #1b2430;
    --topbar-accent: #2b6cb0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.06);
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
    --font-text: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-mono: Consolas, "Cascadia Mono", "Courier New", monospace;
    --font-ui: var(--font-text);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    font-family: var(--font-text);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

/* --- Kopfzeile ------------------------------------------------------------ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 66px;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    border-top: 4px solid var(--topbar-accent);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 28px;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--topbar-text);
}

.brand-name {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.04em;
}

.brand:hover {
    text-decoration: none;
}

/* VERA-Logo (app/static/vera/), Hoehe wie ein Logo in der Kopfzeile */
.vera-logo {
    display: block;
    height: 34px;
    width: auto;
}

.login-logo {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 18px;
}

.vera-hinweis {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.vera-hinweis img {
    height: 18px;
    width: auto;
}

.vera-hinweis a {
    color: inherit;
}

.brand-logo img {
    display: block;
    height: 34px;
    width: auto;
}

.brand-title {
    font-weight: 500;
    font-size: 13px;
    color: var(--topbar-text);
    opacity: 0.75;
    border-left: 1px solid var(--border-strong);
    padding-left: 14px;
    white-space: nowrap;
}

.main-nav {
    flex: 1;
    min-width: 0;                  /* darf schmaler werden als sein Inhalt, sonst laeuft die Seite seitlich ueber */
    display: flex;
    flex-wrap: wrap;               /* wird es eng, brechen die Menuepunkte in eine zweite Zeile um */
    align-items: center;
    gap: 4px;
}

.main-nav a {
    color: var(--topbar-text);
    font-weight: 600;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
}

.main-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    text-decoration: none;
}

.main-nav a.aktiv {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.nav-suche {
    margin-left: auto;
}

.nav-suche .input {
    width: 220px;
    max-width: 100%;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg);
    border-color: transparent;
}

.nav-suche .input:focus {
    background: var(--card);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    margin-left: auto;             /* rechts, auch ohne Hauptnavigation (Kundenbereich) */
    white-space: nowrap;
    color: var(--topbar-text);
    opacity: 0.9;
    font-size: 14px;
}

.user-area a {
    color: var(--topbar-text);
}

.user-area .link-button {
    color: var(--topbar-accent);
    font-weight: 700;
}

/* Zweite Ebene: die Seiten des aktiven Bereichs */
.subnav {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    gap: 6px;
}

.subnav a {
    display: inline-block;
    padding: 12px 14px;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s;
}

.subnav a:hover {
    text-decoration: none;
    color: var(--primary);
}

.subnav a.aktiv {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

/* --- Seite ---------------------------------------------------------------- */

.page-wrap {
    width: 100%;
    max-width: 1240px;
    margin: 28px auto 64px;
    padding: 0 24px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
}

.page-header p {
    margin: 4px 0 0;
}

.with-search .search-form {
    display: flex;
    gap: 8px;
    min-width: 460px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 18px;
}

.narrow-card {
    max-width: 760px;
}

.login-card {
    width: 440px;
    padding: 32px 36px;
}

.login-card h1 {
    font-size: 24px;
}

.centered-panel {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.card h2 {
    font-size: 17px;
    margin-bottom: 14px;
}

.card-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-toolbar h2 {
    margin-bottom: 0;
}

.card-toolbar .actions {
    flex-wrap: nowrap;
}

/* --- Formulare ------------------------------------------------------------ */

.form-grid {
    display: grid;
    gap: 16px 20px;
}

.form-grid.two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.single {
    grid-template-columns: 1fr;
}

.full-span {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.input {
    min-height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font: inherit;
    color: var(--text);
    background: var(--card);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
    color: #a0aaa5;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7772' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.feld-fehler {
    display: block;
    color: var(--danger);
    font-size: 12px;
    font-weight: 400;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    align-self: end;
    min-height: 40px;
}

.checkbox-row.compact {
    min-height: 0;
    font-weight: 500;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* --- Knoepfe -------------------------------------------------------------- */

.btn {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:hover {
    text-decoration: none;
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px var(--primary-ring);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #ffffff;
}

.btn-danger {
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-small {
    padding: 4px 10px;
    min-height: 30px;
    font-size: 12.5px;
    border-radius: 8px;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.link-button:hover {
    text-decoration: underline;
}

.inline-form {
    display: inline;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    text-align: left;
    border-bottom: 1px solid var(--border);
    padding: 11px 10px;
    vertical-align: top;
}

.table thead th {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    padding-top: 4px;
}

.table tbody th {
    font-weight: 600;
    color: var(--muted);
    width: 180px;
}

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

.table tbody tr:hover td {
    background: var(--primary-tint);
}

.table td a strong {
    color: var(--text);
}

.table td a:hover strong {
    color: var(--primary);
}

.actions-col {
    width: 260px;
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.table .actions {
    justify-content: flex-end;
}

.table .actions-col {
    text-align: right;
}

/* --- Kennzeichnungen ------------------------------------------------------ */

.badge,
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    background: #eef1ef;
    color: #4a5550;
    margin: 1px 2px 1px 0;
    white-space: nowrap;
}

.badge-green {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-red {
    background: var(--danger-soft);
    color: var(--danger);
}

.pill {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.muted {
    color: var(--muted);
    font-weight: 400;
}

.small {
    font-size: 12.5px;
}

.ueberfaellig {
    color: var(--danger);
    font-weight: 700;
}

.erledigt {
    color: var(--muted);
    text-decoration: line-through;
}

/* --- Meldungen ------------------------------------------------------------ */

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.flash {
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    background: var(--card);
    font-size: 14px;
}

.flash-success {
    background: var(--primary-tint);
    border-color: #cfe5d6;
    border-left-color: var(--primary);
}

.flash-danger {
    background: var(--danger-soft);
    border-color: #f5c9c5;
    border-left-color: var(--danger);
}

.flash-warning {
    background: var(--warning-soft);
    border-color: #f3dfa6;
    border-left-color: #d99a06;
}

.flash-info {
    background: var(--info-soft);
    border-color: #cfe1f2;
    border-left-color: #2b6cb0;
}

.flash ul {
    margin: 6px 0 6px 18px;
    padding: 0;
}

/* --- Kennzahlen ----------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats-grid:last-child {
    margin-bottom: 0;
}

.stat-card {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.stat-card:hover {
    text-decoration: none;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.stat-card strong {
    display: block;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
}

.card .stats-grid {
    margin-bottom: 18px;
}

/* --- Akte und Zeitleiste -------------------------------------------------- */

.akte-kopf dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 24px;
    margin: 0;
    font-size: 14px;
}

.akte-kopf dt {
    color: var(--muted);
    font-weight: 600;
}

.akte-kopf dd {
    margin: 0;
}

.zeitleiste {
    list-style: none;
    padding: 0;
    margin: 0;
}

.zeitleiste li {
    position: relative;
    padding: 10px 0 14px 22px;
    border-left: 2px solid var(--border);
}

.zeitleiste li::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 15px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card);
}

.zeitleiste li:last-child {
    padding-bottom: 4px;
}

.zeitleiste .meta {
    color: var(--muted);
    font-size: 12.5px;
    margin-bottom: 3px;
}

.search-form select.input {
    width: auto;
}

/* --- Fusszeile ------------------------------------------------------------ */

.pagefooter {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--card);
    padding: 12px 24px;
    font-size: 12.5px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pagefooter .claim {
    color: var(--primary);
    font-weight: 700;
}

/* Rueckweg zur Website und Rechtslinks, nur wenn im Theme gesetzt */
.fuss-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.fuss-links a {
    color: var(--muted);
}

.fuss-links a:hover,
.fuss-links a:focus-visible {
    color: var(--primary);
}

.hinweis-aktionen {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* --- Mittlere Breiten: Kopfzeile verdichten ------------------------------- */

/* Zwischen Tablet und breitem Monitor passen Marke, Hauptnavigation, Suche und
   Benutzerbereich nicht in eine Zeile. Erst verdichten, und wenn es dann noch
   nicht reicht, bricht die Navigation um (.main-nav: min-width 0, flex-wrap).
   Gilt fuer jedes Theme, die Themes setzen hier weder Abstaende noch Breiten. */
@media (max-width: 1440px) {
    .topbar {
        gap: 16px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .brand-title {
        display: none;
    }

    .main-nav a {
        padding: 8px 10px;
    }

    .nav-suche .input {
        width: 160px;
    }
}

/* --- Schmale Bildschirme -------------------------------------------------- */

@media (max-width: 960px) {
    .topbar {
        position: static;
        height: auto;
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 12px;
    }

    .brand-title {
        display: none;
    }

    .main-nav {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
    }

    .nav-suche {
        margin-left: 0;
        width: 100%;
    }

    .nav-suche .input {
        width: 100%;
    }

    .subnav {
        padding: 0 8px;
        overflow-x: auto;
    }

    .page-wrap {
        padding: 0 14px;
        margin-top: 16px;
    }

    .page-header,
    .with-search {
        align-items: stretch;
        flex-direction: column;
    }

    .with-search .search-form {
        min-width: 0;
        flex-wrap: wrap;
    }

    .form-grid.two-cols,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    .login-card {
        width: 100%;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .akte-kopf dl {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }

    .akte-kopf dd {
        margin-bottom: 8px;
    }
}

/* Drei Kennzahlen nebeneinander (zweite Reihe im Dashboard) */
.stats-grid.stats-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Fuenf Kennzahlen nebeneinander, Hinweis-Kachel mit gruenem Rand */
.stats-grid.stats-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card.stat-hinweis {
    border-color: var(--accent);
    background: var(--accent-soft);
}

@media (max-width: 960px) {
    .stats-grid.stats-5,
    .stats-grid.stats-3 {
        grid-template-columns: 1fr;
    }
}

.auswahl-col {
    width: 36px;
    text-align: center;
}

.auswahl-col input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

/* Zuordnung Projekt <-> Ansprechpartner: Rolle, Hinweis und Speichern in einer Zeile */
.zuordnung-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.zuordnung-form .input {
    min-height: 34px;
    padding: 4px 10px;
    font-size: 13.5px;
}

.zuordnung-form select.input {
    width: 170px;
    flex: none;
}

.zuordnung-form input[type="text"] {
    flex: 1;
    min-width: 160px;
}

/* Konzernstruktur: Firmen als Baum, Personen nach Vorgesetzten */
.struktur,
.struktur ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.struktur-firma {
    border-left: 3px solid var(--primary);
    padding: 6px 0 6px 16px;
    margin: 6px 0;
}

.struktur-kopf {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.struktur-toechter {
    margin-left: 12px;
}

.struktur-personen {
    margin: 4px 0 4px 8px;
    font-size: 14px;
}

.struktur-personen ul {
    margin-left: 22px;
    border-left: 1px dashed var(--border-strong);
    padding-left: 12px;
}

.struktur-person {
    padding: 3px 0;
}

.struktur-person.inaktiv > a {
    color: var(--muted);
    text-decoration: line-through;
}

.struktur-person > .muted {
    margin-left: 6px;
}

/* Konzernstruktur als Organigramm: Firmen als Kaesten mit Verbindungslinien,
   darin die Personen nach Vorgesetzten eingerueckt. Reines CSS, keine Bibliothek. */
.org-wrap {
    overflow-x: auto;
    padding: 12px 0 20px;
}

.org,
.org ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.org ul {
    padding-top: 28px;
}

.org li {
    position: relative;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Linie von oben auf jeden Kasten */
.org ul li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 28px;
    background: var(--border-strong);
}

/* Waagerechte Linie ueber Geschwistern */
.org ul li::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-strong);
}

.org ul li:first-child::after {
    left: 50%;
}

.org ul li:last-child::after {
    right: 50%;
}

.org ul li:only-child::after {
    display: none;
}

/* Linie vom Kasten nach unten zu den Toechtern */
.org li > ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 28px;
    background: var(--border-strong);
}

.org-firma {
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px;
    min-width: 230px;
    text-align: left;
}

.org-firma.aktuell {
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.org-firma-name {
    display: block;
    font-weight: 700;
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
}

.org-firma-name:hover {
    color: var(--primary);
    text-decoration: none;
}

.org-firma-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 4px 0 8px;
    color: var(--muted);
    font-size: 13px;
}

/* Personen im Kasten: waagerechter Baum wie die Firmen, Geschwister nebeneinander,
   darunter jeweils der eigene Ast. Initialen-Avatar statt Foto. */
.org-personen {
    padding-top: 8px;
}

.org-personen > li::before,
.org-personen > li::after {
    display: none;
}

.org-personen li {
    padding: 0 6px;
}

.org-personen ul {
    padding-top: 22px;
}

.org-personen ul li::before,
.org-personen li > ul::before {
    height: 22px;
}

.org-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 136px;
    padding: 10px 6px 8px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    line-height: 1.3;
}

.org-person:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.org-person.inaktiv {
    opacity: 0.55;
}

.org-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-tint);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.org-name {
    display: block;
    font-weight: 600;
}

.org-position,
.org-hinweis {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.org-hinweis {
    color: var(--primary-dark);
}

/* Mehrfachauswahl als Kaestchen-Reihe (z. B. Kunde bei unseren Gesellschaften) */
.feldname {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.kaestchen-reihe {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 4px;
}

.kaestchen-reihe ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: contents;
}

.kaestchen-reihe .checkbox-row {
    min-height: 0;
}

/* --- Filterleiste (Listen mit mehreren Filtern) -------------------------- */

.filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) repeat(5, minmax(140px, 1fr));
    gap: 10px 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 18px;
}

.filter-bar .input {
    width: 100%;
    min-width: 0;
}

.filter-bar .filter-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.filter-bar .filter-buttons {
    display: flex;
    gap: 8px;
}

@media (max-width: 1100px) {
    .filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-bar .filter-suche {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .filter-bar {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* --- Textvorlagen ------------------------------------------------------------ */

.vorlage-block {
    display: grid;
    gap: 12px;
    align-content: start;
}

.vorlage-block textarea.input {
    font-family: inherit;
    line-height: 1.45;
}

.vorschau summary {
    cursor: pointer;
}

.vorschau-text {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 6px 0 0;
}

/* --- Projektakte: Kopf, Reiter, Board ------------------------------------ */

.akte-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.akte-header .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.akte-badges {
    margin: 6px 0 0;
}

.akte-spalten {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 32px;
}

.akte-notiz {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    white-space: pre-wrap;
}

.stat-card strong small {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
}

.stats-grid.stats-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fortschritt {
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    margin-top: 10px;
    overflow: hidden;
}

.fortschritt > span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

/* Projektcode und Phasen (Profil, app/profil.py) */

.projektcode {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

h1 .projektcode,
h2 .projektcode {
    font-size: 0.8em;
    margin-right: 4px;
}

.phasen {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 10px 0 4px;
    padding: 0;
}

.phasen li {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.phasen li.phase-erledigt {
    border-color: var(--primary-soft);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.phasen li.phase-erledigt::before {
    content: "\2713\00a0";
}

.phasen li.phase-aktuell {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin: 4px 0 18px;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.tabs a:hover {
    text-decoration: none;
    color: var(--primary);
}

.tabs a.aktiv {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}

.tab-zahl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #eef1ef;
    color: #4a5550;
    font-size: 12px;
    font-weight: 700;
}

.tabs a.aktiv .tab-zahl {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.tabs-js .tab-panel {
    display: none;
}

.tabs-js .tab-panel.aktiv {
    display: block;
}

.sortlink {
    color: inherit;
}

.sortlink.aktiv {
    color: var(--primary-dark);
    text-decoration: underline;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
    align-items: start;
}

.board-col {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 240px;
    transition: border-color 0.15s, background 0.15s;
}

.board-col.drop-ziel {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.board-kopf {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 2px 4px 10px;
}

.board-kopf h3 {
    margin: 0;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.board-karten {
    display: grid;
    gap: 10px;
}

.board-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
}

.board-card[draggable="true"]:active {
    cursor: grabbing;
}

.board-card.dragging,
.board-card.wird-verschoben {
    opacity: 0.5;
}

.board-col[data-stand="in_arbeit"] .board-card {
    border-left-color: var(--primary);
}

.board-col[data-stand="erledigt"] .board-card {
    border-left-color: var(--border);
    opacity: 0.85;
}

.board-card.ueberfaellig-karte {
    border-left-color: var(--danger);
}

.board-titel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.board-text {
    margin: 6px 0 0;
}

.board-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 8px;
}

.board-aktionen {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.board-leer {
    text-align: center;
    padding: 24px 0;
}

@media (max-width: 960px) {
    .akte-spalten,
    .board,
    .stats-grid.stats-4 {
        grid-template-columns: 1fr;
    }
}

/* --- Verwaltung und oeffentliche Formulare -------------------------------- */

.kaestchen-liste {
    display: grid;
    gap: 6px;
    margin-bottom: 4px;
}

.kaestchen-liste ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: contents;
}

.kaestchen-liste .checkbox-row {
    min-height: 0;
    align-items: flex-start;
}

body.oeffentlich .page-wrap {
    max-width: 760px;
}

.formular-card h1 {
    font-size: 24px;
}

/* Bot-Falle im Anfrageformular: aus dem Bild geschoben statt display:none,
   damit auch Bots sie sehen, die auf display achten. */
.honigtopf {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

fieldset.noten {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px 12px;
    margin: 0;
}

fieldset.noten legend {
    font-weight: 600;
    font-size: 14px;
    padding: 0 6px;
}

.noten-reihe {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.noten-reihe .note {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 52px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

.noten-reihe .note:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.noten-reihe input[type="radio"] {
    accent-color: var(--primary);
    margin: 0;
}

/* --- Herkunftshinweis "made by GOATCODE" ---------------------------------- */
/* Hinter dem Produkttitel in der Kopfzeile, klein, grau, Ziege rechts vom Text.
   Regel: Vault, 03 Wissen/Herkunftshinweis made by GOATCODE. Themes setzen nur die Farbe. */

.powered {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 12px;
    vertical-align: middle;
    color: #6b7470;
    font: 600 0.7rem/1 Consolas, "Cascadia Mono", "IBM Plex Mono", monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    text-decoration: none;
}

.powered svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
}

@media (max-width: 640px) {
    .powered span {
        display: none;
    }

    /* Schmale Bildschirme: Unternavigation scrollt fuer sich, lange Knopftexte
       brechen um, statt die Seite seitlich zu verbreitern */
    .subnav {
        overflow-x: auto;
        padding: 0 12px;
    }

    .subnav a {
        white-space: nowrap;
    }

    .btn {
        white-space: normal;
        text-align: center;
    }
}

@media print {
    .powered {
        color: #000;
    }
}
