/* TOP – Custom Styles */

/* ── TÜV SÜD Brand Colors ──────────────────────────
   Deep Navy:    #0B253B  (navbar, dark sections)
   Royal Blue:   #0046AD  (primary, buttons, links)
   Navy Hover:   #113553  (hover on dark surfaces)
   Teal Accent:  #02ECA6  (accents, highlights)
   Light Bg:     #FAFBFE  (page/card backgrounds)
   ─────────────────────────────────────────────── */

:root {
    --top-primary:       #0046AD;
    --top-primary-dark:  #003d99;
    --top-navy:          #0B253B;
    --top-navy-hover:    #113553;
    --top-teal:          #02ECA6;
    --top-light-bg:      #FAFBFE;
    --top-sidebar-width: 240px;

    /* Override Bootstrap 5 primary */
    --bs-primary:             #0046AD;
    --bs-primary-rgb:         0, 70, 173;
    --bs-link-color:          #0046AD;
    --bs-link-color-rgb:      0, 70, 173;
    --bs-link-hover-color:    #003d99;
    --bs-btn-bg:              #0046AD;
    --bs-btn-border-color:    #0046AD;
}

/* ── General ──────────────────────────────────── */
body {
    font-size: 0.925rem;
    background-color: var(--top-light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.footer {
    margin-top: auto;
}

/* ── Bootstrap Primary overrides ──────────────── */
.btn-primary {
    --bs-btn-bg:              #0046AD;
    --bs-btn-border-color:    #0046AD;
    --bs-btn-hover-bg:        #003d99;
    --bs-btn-hover-border-color: #003580;
    --bs-btn-active-bg:       #003580;
    --bs-btn-active-border-color: #002d6b;
    --bs-btn-disabled-bg:     #0046AD;
    --bs-btn-disabled-border-color: #0046AD;
}

.btn-outline-primary {
    --bs-btn-color:           #0046AD;
    --bs-btn-border-color:    #0046AD;
    --bs-btn-hover-bg:        #0046AD;
    --bs-btn-hover-border-color: #0046AD;
    --bs-btn-active-bg:       #003d99;
    --bs-btn-active-border-color: #003d99;
}

.bg-primary {
    background-color: #0046AD !important;
}

.text-primary {
    color: #0046AD !important;
}

.border-primary {
    border-color: #0046AD !important;
}

.badge.bg-primary {
    background-color: #0046AD !important;
}

/* Form focus ring */
.form-control:focus,
.form-select:focus {
    border-color: #0046AD;
    box-shadow: 0 0 0 0.25rem rgba(0, 70, 173, 0.2);
}

/* Pagination */
.page-item.active .page-link {
    background-color: #0046AD;
    border-color: #0046AD;
}
.page-link {
    color: #0046AD;
}
.page-link:hover {
    color: #003d99;
}

/* ── Navbar ────────────────────────────────────── */
.navbar.navbar-dark.bg-primary,
nav.navbar.bg-primary {
    background-color: var(--top-navy) !important;
}

/* Marke: Docarta-Logo, daneben Firmenlogo auf weißem Grund (hochgeladene Logos sind oft dunkel) */
.navbar-brand-logo { height: 30px; width: auto; }
.navbar-company {
    border-left: 1px solid rgba(255,255,255,.25);
    padding-left: .75rem;
    font-size: .95rem;
}
.navbar-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
    max-width: 120px;
    background: #fff;
    border-radius: 4px;
    padding: 2px 4px;
}

/* Navbar active/current link highlight */
.navbar-dark .navbar-nav .nav-link.active,
.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--top-teal) !important;
}

/* Dropdown menu in navbar */
.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
    border-top: 3px solid var(--top-primary);
}
.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    background-color: rgba(0, 70, 173, 0.08);
    color: var(--top-primary);
}

/* ── Login Page ────────────────────────────────── */
.login-page {
    background: linear-gradient(135deg, var(--top-navy) 0%, #0046AD 100%);
}

.brand-logo-lg {
    height: 64px;
    width: auto;
    max-width: 100%;
}
/* Anmeldeseiten: Untertitel auf dem dunklen Verlauf lesbar */
.login-page .text-center > .text-muted { color: rgba(255,255,255,.75) !important; }
.company-logo {
    background: #fff;
    border-radius: 4px;
    padding: 3px 6px;
    height: 36px;
    width: auto;
    object-fit: contain;
    max-width: 160px;
}

/* ── Dashboard Stats ───────────────────────────── */
.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.1) !important;
}
.stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Project Cards ─────────────────────────────── */
.project-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.1) !important;
}

/* ── Tables ────────────────────────────────────── */
.table > :not(caption) > * > * {
    padding: .6rem .75rem;
}

/* ── Cards ─────────────────────────────────────── */
.card {
    border-radius: 0.5rem;
}

/* Card header accent line */
.card.border-0 > .card-header {
    border-bottom: 1px solid rgba(0, 70, 173, 0.12);
}

/* ── Avatar Circle ─────────────────────────────── */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--top-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ── Ticket description ────────────────────────── */
.ticket-description {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Upload Area ───────────────────────────────── */
.upload-area {
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    border: 2px dashed #dee2e6 !important;
    border-radius: 0.5rem;
    user-select: none;
}
.upload-area:hover,
.upload-area.drag-over {
    background-color: rgba(0, 70, 173, 0.06);
    border-color: var(--top-primary) !important;
}

/* ── Color Swatch ──────────────────────────────── */
.color-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
}

/* ── Breadcrumb ────────────────────────────────── */
.breadcrumb {
    font-size: 0.85rem;
    background: transparent;
    padding: 0;
}

/* ── Badges ────────────────────────────────────── */
.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Nav Tabs ──────────────────────────────────── */
.nav-tabs .nav-link {
    color: #495057;
}
.nav-tabs .nav-link.active {
    font-weight: 600;
    color: var(--top-primary);
    border-bottom-color: var(--top-primary);
}
.nav-tabs .nav-link:hover:not(.active) {
    color: var(--top-primary);
}

/* ── List Group ────────────────────────────────── */
.list-group-item-action:hover {
    background-color: rgba(0, 70, 173, 0.05);
}

/* Active list group item → use navy */
.list-group-item-action.active {
    background-color: var(--top-primary);
    border-color: var(--top-primary);
}

/* ── Internal comment border ───────────────────── */
.border-3 {
    border-width: 3px !important;
}

/* ── Opacity ───────────────────────────────────── */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* ── Responsive Table ──────────────────────────── */
@media (max-width: 576px) {
    .table-responsive .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
}

/* ── Scrollable Sidebar ────────────────────────── */
@media (min-width: 992px) {
    .sticky-sidebar {
        position: sticky;
        top: 1rem;
    }
}

/* ── Container max width (nur im Hauptbereich) ─── */
@media (min-width: 1400px) {
    .app-main .container-fluid {
        max-width: 1400px;
    }
}

.doc-table { table-layout: fixed; }

/* ── Dokumenten-Tabelle: Gliederungszeilen ─────── */
.doc-group-top {
    background-color: var(--top-navy) !important;
    color: #fff !important;
    user-select: none;
}
.doc-group-top > td {
    padding: .6rem 1rem !important;
    font-size: 1rem;
    border: none !important;
    border-bottom: 2px solid rgba(255,255,255,.07) !important;
}
.doc-group-top:hover > td { background-color: var(--top-navy-hover) !important; }

.doc-group-sub {
    background-color: rgba(0,70,173,.06) !important;
    user-select: none;
}
.doc-group-sub > td {
    padding: .42rem 1rem !important;
    font-size: .9rem;
    font-weight: 600;
    color: var(--top-primary) !important;
    border-bottom: 1px solid rgba(0,70,173,.09) !important;
}
.doc-group-sub:hover > td { background-color: rgba(0,70,173,.11) !important; }

/* Toggle-Icon – kein CSS-Trick, Klasse wird per JS gewechselt */
.doc-toggle-icon { display: inline-block; }

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .doc-group-sub { background-color: rgba(0,70,173,.18) !important; }
    .doc-group-sub > td { border-bottom-color: rgba(0,70,173,.25) !important; }
}

/* ── Teal accent helpers ───────────────────────── */
.text-teal   { color: var(--top-teal) !important; }
.bg-teal     { background-color: var(--top-teal) !important; }
.border-teal { border-color: var(--top-teal) !important; }

/* ── Page header stripe (optional) ────────────── */
.page-header-bar {
    background: linear-gradient(90deg, var(--top-navy) 0%, #0046AD 100%);
    color: #fff;
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
}

/* ── Quill Rich-Text-Editor ────────────────────── */
.ql-toolbar.ql-snow { border-radius: .375rem .375rem 0 0; border-color: #dee2e6; }
.ql-container.ql-snow { border-radius: 0 0 .375rem .375rem; border-color: #dee2e6; font-size: 1rem; }
.ql-editor { min-height: 120px; }
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before { content: attr(data-value) !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=""]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=""]::before { content: 'Normal' !important; }

/* Ticket-Link-Button in Quill-Toolbar */
.ql-ticket-link .bi { vertical-align: middle; }
button.ql-ticket-link { width: auto !important; padding: 0 4px !important; }

/* Ticket-Beschreibung Anzeige */
.ticket-description { line-height: 1.65; word-break: break-word; }
.ticket-description a { color: var(--bs-primary); }
.ticket-description p { margin-bottom: .4rem; }
.ticket-description p:last-child { margin-bottom: 0; }
.ticket-description ul, .ticket-description ol { padding-left: 1.5rem; margin-bottom: .4rem; }

/* ── App Layout (Sidebar + Main) ─────────────────── */
.app-wrapper {
    display: flex;
    align-items: flex-start;
}
.app-main {
    flex: 1;
    min-width: 0;
}

/* ── Sidebar ─────────────────────────────────────── */
.app-sidebar {
    width: var(--top-sidebar-width);
    min-width: var(--top-sidebar-width);
    background: var(--top-navy);
    flex-shrink: 0;
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,.06);
}
/* Nur die Projektliste scrollt; Ankerblock oben und Fixieren-Knopf unten bleiben stehen */
.sidebar-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 2px;
}

/* Sidebar-Kopf */
.sidebar-header {
    padding: .6rem .9rem .45rem;
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.28);
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

/* Projekt-Zeile */
.sidebar-project { border-bottom: 1px solid rgba(255,255,255,.04); }

/* ── Unterprojekt-Einrückung ──────────────────────────────────────────────── */

/* Der Link des Unterprojekts: zusätzliches left-padding für die Einrückung */
.sp-child-link {
    padding-left: 1.6rem !important;  /* statt .9rem */
    font-weight: 500 !important;
    font-size: .79rem !important;
    color: rgba(255,255,255,.62) !important;
}
.sp-child-link:hover { color: rgba(255,255,255,.9) !important; }

/* Aktiver Zustand bleibt wie beim Elternteil */
.sidebar-project.sp-active > .sidebar-project-head > .sp-child-link {
    color: var(--top-teal) !important;
}

/* Kleines L-förmiges Einrückungs-Icon */
.sp-child-indent {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: .3rem;
    color: rgba(255,255,255,.25);
    font-size: .65rem;
    /* Unicode Linie-nach-rechts */
}
.sp-child-indent::before { content: '↳'; }

/* Section-Labels und Items im Unterprojekt ebenfalls einrücken */
.sidebar-section-label.sp-child-section { padding-left: 1.6rem; }
.sidebar-item.sp-child-item             { padding-left: 1.8rem; }
.sidebar-project-head { display: flex; align-items: stretch; }
.sidebar-project-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .5rem .5rem .9rem;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    font-size: .81rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background-color var(--top-duration-fast,100ms) ease,
                color            var(--top-duration-fast,100ms) ease,
                border-color     var(--top-duration-fast,100ms) ease;
    line-height: 1.25;
}
.sidebar-project-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-project.sp-active > .sidebar-project-head > .sidebar-project-link {
    border-left-color: var(--top-teal);
    color: var(--top-teal);
}

/* Chevron-Schaltfläche */
.sidebar-chevron {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,.28);
    padding: .5rem .75rem;
    font-size: .68rem;
    line-height: 1;
    cursor: pointer;
    transition: color 100ms ease, transform 100ms ease;
}
.sidebar-chevron:hover { color: rgba(255,255,255,.65); }
.sidebar-chevron.rotated { transform: rotate(90deg); }

/* Abschnittsbeschriftung */
.sidebar-section-label {
    font-size: .6rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.28);
    padding: .55rem .9rem .1rem 1.55rem;
    font-weight: 700;
}

/* Kategorie-Eintrag */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .6rem .28rem 1.75rem;
    font-size: .78rem;
    color: rgba(255,255,255,.62);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 100ms ease, color 100ms ease;
    line-height: 1.3;
}
.sidebar-item:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.92); }
.sidebar-item.si-active {
    background: rgba(0,70,173,.22);
    color: #fff;
    border-left-color: var(--top-primary);
}
.sidebar-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-item .badge {
    flex-shrink: 0;
    font-size: .58rem;
    min-width: 15px;
    padding: 1px 4px;
    line-height: 1.4;
}

/* Kopfleiste: Punkte und Suche nicht umbrechen, die Suche darf schmaler werden */
@media (min-width: 992px) {
    .navbar .nav-link { white-space: nowrap; }
    .navbar form[role="search"] { flex: 0 1 220px; min-width: 120px; }
    .navbar form[role="search"] .input-group { flex-wrap: nowrap; }
    .navbar form[role="search"] input { min-width: 0 !important; }
}

/* Ankerblock: zentrale Punkte über alle Projekte, bleibt beim Scrollen stehen */
.app-sidebar-slot { flex: none; align-self: stretch; width: var(--top-sidebar-width); }
.sidebar-top {
    flex-shrink: 0;
    background: var(--top-navy);
    border-bottom: 1px solid rgba(255,255,255,.1);
    padding: .35rem 0 .45rem;
}
.sidebar-anchor {
    display: flex; align-items: center; gap: .65rem;
    padding: .42rem .9rem;
    color: rgba(255,255,255,.82); text-decoration: none;
    font-size: .84rem; font-weight: 600; white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background-color 100ms ease, color 100ms ease;
}
.sidebar-anchor .bi { font-size: 1rem; width: 1.1rem; text-align: center; flex: none; }
.sidebar-anchor:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-anchor.sa-active { background: rgba(0,70,173,.28); color: #fff; border-left-color: var(--top-teal); }
.sidebar-anchor:focus-visible, .sidebar-pin:focus-visible { outline: 2px solid var(--top-teal); outline-offset: -2px; }
.sidebar-tools { display: flex; gap: .35rem; padding: .45rem .7rem 0; }
.sidebar-tools .form-control {
    background: rgba(255,255,255,.08); border: 0; color: #fff; font-size: .78rem;
}
.sidebar-tools .form-control::placeholder { color: rgba(255,255,255,.4); }
.sidebar-tools .form-control:focus { background: rgba(255,255,255,.14); color: #fff; box-shadow: 0 0 0 2px rgba(10,160,180,.5); }
.sidebar-tool-btn {
    flex: none; background: rgba(255,255,255,.08); border: 0; border-radius: .3rem;
    color: rgba(255,255,255,.7); padding: 0 .5rem; line-height: 1;
}
.sidebar-tool-btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.sidebar-recent { padding-bottom: .3rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-recent a { display: flex; align-items: center; gap: .45rem; padding: .28rem .9rem; font-size: .8rem;
    color: rgba(255,255,255,.72); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-recent a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-project[hidden] { display: none; }
.sidebar-pin {
    flex-shrink: 0;
    background: var(--top-navy); border: 0; border-top: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.6); padding: .5rem .9rem; text-align: left; font-size: .78rem; white-space: nowrap;
}
.sidebar-pin:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-pin > span { display: flex; align-items: center; gap: .65rem; }
.sidebar-pin .bi { width: 1.1rem; text-align: center; flex: none; }
.sb-pin-to-open { display: none !important; }

/* Mobiles Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
    cursor: pointer;
}
.sidebar-backdrop.show { display: block; }

/* Mobiler Toggle-Button in Navbar */
#sidebarToggle {
    color: rgba(255,255,255,.75);
    border: none;
    background: none;
    padding: .35rem .5rem;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: .3rem;
    transition: color 100ms ease, background-color 100ms ease;
}
#sidebarToggle:hover { color: #fff; background: rgba(255,255,255,.1); }

@media (max-width: 991.98px) {
    .app-sidebar-slot { display: contents; }
    .sidebar-pin { display: none; }
    .app-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }
    .app-sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.45);
    }
}

/* ── Seitenleiste als schmale Leiste (kleinere Bildschirme, Wahl des Benutzers) ─────────
   html.sb-rail wird per Skript gesetzt (docartaSidebarApply); .sb-expanded klappt die Leiste bei
   MouseOver, Fokus oder Antippen über den Inhalt auf, ohne ihn zu verschieben. */
@media (min-width: 992px) {
    html.sb-rail .app-sidebar-slot { width: 56px; }
    html.sb-rail .app-sidebar { width: 56px; min-width: 56px; transition: width 160ms ease, box-shadow 160ms ease; }
    html.sb-rail .app-sidebar.sb-expanded {
        width: var(--top-sidebar-width); min-width: var(--top-sidebar-width);
        z-index: 999; box-shadow: 6px 0 24px rgba(0,0,0,.4);
    }
    html.sb-rail .sb-pin-to-rail { display: none !important; }
    html.sb-rail .sb-pin-to-open { display: flex !important; }
    html.sb-rail .app-sidebar:not(.sb-expanded) .sb-label,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sb-collapsible,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-header,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-chevron,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-section-label,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-item,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project .collapse,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project:not([data-parent="0"]),
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project-link > span { display: none !important; }
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-anchor,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project-link,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-pin > span { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-anchor .bi,
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project-link .bi { font-size: 1.1rem; }
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-project-link { padding-top: .6rem; padding-bottom: .6rem; }
    html.sb-rail .app-sidebar:not(.sb-expanded) .sidebar-pin { padding-left: 0; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
    html.sb-rail .app-sidebar { transition: none; }
}

/* Aktionsknöpfe in Listenzeilen (Stift, Mülleimer …): gleiche Höhe und Lage. Ein Löschknopf steckt meist in
   einem Inline-Formular, das sich sonst an der Textgrundlinie ausrichtet und tiefer sitzt. */
.d-flex > form.d-inline { display: inline-flex !important; }
.list-group-item .d-flex > .btn, .list-group-item .d-flex > form { align-self: center; }

/* Zwischenüberschrift innerhalb einer Karte (z. B. Workflows / Status) */
.ps-subhead { padding: .45rem 1rem; background: var(--bs-tertiary-bg, #f8f9fa); border-top: 1px solid var(--bs-border-color, #dee2e6);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6); font-size: .72rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--bs-secondary-color, #6c757d); }
.card-header + .ps-subhead { border-top: 0; }
.wf-default-badge { font-size: .68rem; font-weight: 600; padding: .15rem .45rem; border-radius: .3rem;
    background: #eef2f7; color: #475569; border: 1px solid #cbd5e1; }

/* ── Workflow-Diagramm ─────────────────────────────── */
/* Farben als Variablen – das Skript (workflow_diagram.js) liest sie, damit das dunkle Design passt */
:root {
    --wf-bg: #fff; --wf-dot: #dee2e6; --wf-edge: #334155; --wf-edge-off: #adb5bd;
    --wf-label-bg: #e6f7f9; --wf-label-fg: #0b5563; --wf-label-border: #0aa0b4;
    --wf-unused-bg: #f8f9fa; --wf-unused-fg: #6c757d; --wf-unused-border: #ced4da;
    --wf-start: #15803d;
}
.wf-canvas { background: var(--wf-bg); background-image: radial-gradient(var(--wf-dot) 1px, transparent 1px); background-size: 18px 18px; }
.wf-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; align-items: center; }
.wf-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.wf-legend-line { display: inline-block; width: 26px; border-top: 2.5px solid var(--wf-edge); }
.wf-legend-dashed { border-top-style: dashed; }
.wf-legend-tag { display: inline-flex; align-items: center; gap: .2rem; padding: 0 .45rem; border-radius: 9px;
    background: var(--wf-label-bg); border: 1px solid var(--wf-label-border); color: var(--wf-label-fg); font-weight: 600; font-size: .75rem; }
.wf-start-badge, .wf-legend-start { display: inline-flex; align-items: center; gap: .1rem; padding: .05rem .4rem .05rem .25rem;
    border-radius: 9px; background: var(--wf-start); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.3; }
.wf-start-badge { position: absolute; top: -12px; left: -8px; box-shadow: 0 1px 3px rgba(0,0,0,.3); pointer-events: none; }
.wf-role-table .wf-row-off td { color: var(--bs-secondary-color, #6c757d); }
.wf-role-table .wf-row-dev td { background: var(--wf-label-bg); }
.wf-role-table .form-select { min-width: 180px; }
.wf-legend-unused { display: inline-block; width: 22px; height: 14px; border: 2px dashed var(--wf-unused-border); border-radius: 4px; background: var(--wf-unused-bg); }

/* ── Animation-Tokens ──────────────────────────────── */
:root {
    --top-duration-fast:   100ms;
    --top-duration-normal: 200ms;
    --top-ease:            cubic-bezier(.4,0,.2,1);
}

/* Transitions vereinheitlichen */
.btn { transition: all var(--top-duration-fast) var(--top-ease); }
.card.stat-card, .card.project-card {
    transition: transform var(--top-duration-normal) var(--top-ease),
                box-shadow var(--top-duration-normal) var(--top-ease);
}
.list-group-item-action {
    transition: background-color var(--top-duration-fast) var(--top-ease);
}

/* ── Empty States ──────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: #6c757d;
    text-align: center;
}
.empty-state .empty-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    line-height: 1;
}
.empty-state .empty-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #495057;
}
.empty-state .empty-sub {
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ── Card Accent Variants ──────────────────────────── */
.card-accent-teal    { border-left: 4px solid var(--top-teal) !important; }
.card-accent-primary { border-left: 4px solid var(--top-primary) !important; }
.card-accent-danger  { border-left: 4px solid var(--bs-danger) !important; }
.card-accent-warning { border-left: 4px solid var(--bs-warning) !important; }
.card-accent-success { border-left: 4px solid var(--bs-success) !important; }

/* ── Teal als semantische Akzentfarbe ──────────────── */
.badge.bg-teal { background-color: var(--top-teal) !important; color: #0B253B !important; }
.progress-bar.bg-teal { background-color: var(--top-teal) !important; }

/* Status-Dot-Pattern */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 0.4em;
    vertical-align: middle;
}

/* ── Skeleton-Loader (CSS-only) ────────────────────── */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #e8edf2 25%, #f5f7fa 50%, #e8edf2 75%);
    background-size: 800px 100%;
    animation: skeleton-shimmer 1.4s infinite linear;
    border-radius: 4px;
    color: transparent !important;
}
.skeleton-text   { height: 1em;   margin-bottom: 0.5rem; }
.skeleton-title  { height: 1.4em; width: 60%; margin-bottom: 0.75rem; }
.skeleton-row    { height: 2.5rem; margin-bottom: 0.25rem; border-radius: 0; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }

/* ── Table-Verbesserungen ──────────────────────────── */
.table-hover > tbody > tr:hover > * {
    background-color: rgba(0, 70, 173, 0.04);
}
.table-compact > :not(caption) > * > * {
    padding: .3rem .6rem;
    font-size: 0.85rem;
}
.table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}
.table-sticky-head thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    box-shadow: 0 1px 0 #dee2e6;
}

/* ── Accessibility: Focus-Ring ─────────────────────── */
:focus-visible {
    outline: 3px solid var(--top-teal);
    outline-offset: 2px;
    border-radius: 3px;
}
.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(2, 236, 166, 0.4);
}

/* ── Checklist Progress Ring ───────────────────────── */
.checklist-progress-ring {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: conic-gradient(var(--top-teal) calc(var(--pct, 0) * 1%), #dee2e6 0%);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 700; color: #333;
    position: relative;
}
.checklist-progress-ring::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: white;
}
.checklist-progress-ring .ring-label {
    position: relative;
    z-index: 1;
}

/* ── Page Header Bar ───────────────────────────────── */
.page-header-bar h1, .page-header-bar h2 { font-size: 1.15rem; }
.page-header-bar .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255,255,255,.4);
}

/* ── Einklappbare Blöcke (data-collapsible) ──────────────────────────────────
   Standardmäßig eingeklappt (PC und Smartphone); Klick auf die Überschrift öffnet/schließt
   (Klasse .is-open). Eine Fußzeile (Aktionen) bleibt immer sichtbar. */
.card[data-collapsible] > .card-header.cc-head { cursor: pointer; user-select: none; }
.card[data-collapsible] > .card-header.cc-head:focus-visible { outline: 2px solid var(--top-primary); outline-offset: -2px; }
/* Pfeil als runde, gut sichtbare Schaltfläche */
.cc-chevron {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--bs-secondary-bg); color: var(--bs-emphasis-color);
    font-size: 1rem; -webkit-text-stroke: .6px; transition: transform .15s ease, background .15s ease;
}
.cc-head:hover .cc-chevron { background: var(--bs-tertiary-color); color: #fff; }
.cc-head:not(.d-flex) .cc-chevron { float: right; margin: -.3rem 0 0 .5rem; }
/* Flex-Kopfzeile: vorletztes Element (z. B. Status, Knöpfe) nach rechts, Pfeil direkt dahinter */
.cc-head.d-flex { justify-content: flex-start !important; }
.cc-head.d-flex > .cc-chevron { margin-left: .5rem; }
.cc-head.d-flex > :nth-last-child(2):not(:first-child) { margin-left: auto; }
.cc-head.d-flex > :first-child { min-width: 0; }

/* Lange Wörter (z. B. Dokumentnamen) umbrechen statt die Seite zu verbreitern */
.app-main h1, .app-main h2, .app-main h3, .app-main h4, .app-main h5, .app-main h6,
.breadcrumb-item, .card-header { overflow-wrap: anywhere; hyphens: auto; }
.card-header.d-flex > :first-child { min-width: 0; }
.card-header .badge, .card-header .btn { flex: none; }
.cc-head[aria-expanded="false"] .cc-chevron { transform: rotate(-90deg); }
.card[data-collapsible]:not(.is-open) > :not(.card-header):not(.card-footer) { display: none !important; }
.card[data-collapsible]:not(.is-open) > .card-header { border-bottom: 0; }

/* ══ Smartphones ════════════════════════════════════════════════════════════
   Schwerpunkt: Dokumente und offene Punkte lesen und bearbeiten. Nebenspalten und
   Verwaltungsknöpfe (Projektleitung, Export, Upload) werden mit .m-hide ausgeblendet;
   die PC-Ansicht bleibt unverändert. */
@media (max-width: 767.98px) {
    .m-hide { display: none !important; }

    .app-main > .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
    .app-main h1, .app-main .h1 { font-size: 1.5rem; }
    .app-main h2, .app-main .h2 { font-size: 1.35rem; }
    .app-main h3, .app-main .h3 { font-size: 1.2rem; }
    .breadcrumb { font-size: .8rem; margin-bottom: .5rem; }

    /* Reiter in einer wischbaren Zeile statt mehrzeilig */
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link { white-space: nowrap; padding: .5rem .75rem; }

    /* Kennzahlen auf dem Dashboard: 2 × 2 kompakt */
    .stat-card .card-body { padding: .75rem; }
    .stat-card .stat-icon { width: 40px !important; height: 40px !important; font-size: 1.1rem !important; }
    .stat-card .fs-2 { font-size: 1.2rem !important; line-height: 1.2; }
    .stat-card .stat-icon { margin-right: .6rem !important; }
    .stat-card .text-muted { font-size: .78rem; }

    /* Projektkopf: Beschreibung auf zwei Zeilen begrenzen */
    .project-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .875rem; }

    /* Tabellen: feste Spaltenbreiten aufheben, Zellen enger */
    #docMasterTable { table-layout: auto; }
    #docMasterTable col { width: auto !important; }
    #docMasterTable td:first-child { padding-left: .75rem !important; }
    .table > :not(caption) > * > * { padding: .55rem .5rem; }

    /* Detail-Listen: Bezeichnung und Wert nebeneinander statt untereinander */
    dl.row > dt.col-sm-4, dl.row > dt.col-sm-3 { flex: 0 0 42%; max-width: 42%; font-size: .9em; hyphens: auto; overflow-wrap: normal; }
    dl.row > dd.col-sm-8, dl.row > dd.col-sm-9 { flex: 0 0 58%; max-width: 58%; }
}

/* Touch-Geräte: kleine Knöpfe gut treffbar */
@media (pointer: coarse) {
    .btn-sm { min-height: 2.25rem; min-width: 2.25rem; }
    .btn-group-sm > .btn { min-height: 2.25rem; }
}

/* ── Dark Mode ─────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --top-light-bg: #0f1923;
    }
    body { background-color: #0f1923; color: #e2e8f0; }

    .card {
        background-color: #162030;
        border-color: #2d3f52;
        color: #e2e8f0;
    }
    .card-header.bg-white { background-color: #1e2f40 !important; color: #e2e8f0; }
    .card-header { border-bottom-color: #2d3f52 !important; }

    .list-group-item {
        background-color: #162030;
        border-color: #2d3f52;
        color: #e2e8f0;
    }
    .list-group-item-action:hover {
        background-color: rgba(0, 70, 173, 0.15);
        color: #e2e8f0;
    }

    .table {
        --bs-table-bg: #162030;
        --bs-table-color: #e2e8f0;
        --bs-table-border-color: #2d3f52;
        --bs-table-striped-bg: #1a2840;
        --bs-table-hover-bg: rgba(0,70,173,.12);
    }
    .table-sticky-head thead th { background: #162030; box-shadow: 0 1px 0 #2d3f52; }

    .form-control, .form-select, .input-group-text {
        background-color: #1e2f40;
        border-color: #2d3f52;
        color: #e2e8f0;
    }
    .form-control::placeholder { color: #708090; }
    .form-control:focus, .form-select:focus { background-color: #1e2f40; color: #e2e8f0; }

    .navbar .dropdown-menu { background-color: #162030; border-color: #2d3f52; }
    .navbar .dropdown-item { color: #c8d6e5; }
    .navbar .dropdown-item:hover { background-color: rgba(0,70,173,.15); color: #fff; }

    .modal-content { background-color: #162030; border-color: #2d3f52; color: #e2e8f0; }
    .modal-header { border-bottom-color: #2d3f52; }
    .modal-footer { border-top-color: #2d3f52; }

    .alert { border-color: #2d3f52; }
    .alert-info    { background-color: #0d2035; color: #93c5fd; }
    .alert-success { background-color: #0d2318; color: #6ee7b7; }
    .alert-danger  { background-color: #250d0d; color: #fca5a5; }
    .alert-warning { background-color: #241a00; color: #fcd34d; }

    .bg-light  { background-color: #1e2f40 !important; }
    .bg-white  { background-color: #162030 !important; }
    .text-muted { color: #7a9ab5 !important; }
    .border-bottom { border-bottom-color: #2d3f52 !important; }
    .footer { background-color: #162030 !important; border-top-color: #2d3f52 !important; }

    .skeleton {
        background: linear-gradient(90deg, #1e2f40 25%, #253545 50%, #1e2f40 75%);
        background-size: 800px 100%;
    }

    .empty-state .empty-title { color: #93b4cc; }

    .table-sticky-head thead th { background: #162030; }

    /* Zwischenüberschriften in Karten (z. B. Workflows / Status) und Kennzeichen */
    .ps-subhead { background: #1a2838; color: #93b4cc; border-color: #2d3f52; }
    .card .border-top { border-top-color: #2d3f52 !important; }
    .wf-default-badge { background: #22364a; color: #b6cbe0; border-color: #3a5068; }
    .form-text { color: #7a9ab5; }
    .wf-role-table .wf-row-off td { color: #7a9ab5; }
    :root {
        --wf-bg: #121c28; --wf-dot: #26384b; --wf-edge: #cbd5e1; --wf-edge-off: #5b7088;
        --wf-label-bg: #0d3640; --wf-label-fg: #9ee7f0; --wf-label-border: #0aa0b4;
        --wf-unused-bg: #1a2838; --wf-unused-fg: #7a9ab5; --wf-unused-border: #3a5068;
        --wf-start: #22c55e;
    }
}
