/* =========================================================
   CSS-VARIABLEN & GLOBALE STYLES
   ========================================================= */

:root {
    --blue: #0b4f8a;
    --blue2: #0e68b1;
    --soft: #eef6fc;
    --line: #d6e6f2;
    --text: #102a43;
    --muted: #5f7182;
    --danger: #b42318;
    --ok: #0f766e;
}

* {
    box-sizing: border-box;
}

body {
   margin: 0;
   font-family: "Exo 2", Calibri, Candara, "Segoe UI", Segoe, Optima, Arial, system-ui, -apple-system, sans-serif; /* "Exo 2" nach vorne gestellt */
   background: #f7fbff;
   color: var(--text);
}
      
.footer {
    text-align: center;
    color: var(--muted);
    padding: 2rem;
}

/* =========================================================
   FIXIERTES HAUPTMENÜ & USERBAR
   ========================================================= */

.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 1rem;
    box-shadow: 0 2px 10px #002b4d33;
    min-height: 3.7rem;
}

.brand {
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    min-height: 3.7rem;
    display: flex;
    align-items: center;
    padding: 0 0.9rem;
    border-right: 1px solid rgba(255,255,255,0.18);
}

.navlinks {
    display: flex;
    gap: 0;
    align-items: center;
    margin-left: auto; /* Schiebt die Menüpunkte nach rechts */
    min-height: 3.7rem;
}

.navlinks a {
    color: #fff;
    text-decoration: none;
    min-height: 3.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.8rem;
    border-left: 1px solid rgba(255,255,255,0.18);
    font-size: 1rem;
    white-space: nowrap;
}

.navlinks a:hover {
    background: #ffffff1e;
}

/* Aktive Zustände Hauptmenü mit getauschten Farben */
.topnav a.active,
.topnav a.active:visited,
.navlinks a.active,
.navlinks a.active:visited,
.brand.active,
.brand.active:visited {
    background: #fff;
    color: var(--blue) !important;
}

.topnav a.active:hover,
.navlinks a.active:hover,
.brand.active:hover {
    background: #fff;
    color: var(--blue) !important;
}

.menu-toggle {
    display: none;
    background: #fff;
    color: var(--blue);
    border: 0;
    padding: 0.35rem 0.55rem;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Nutzerzeile unter dem Hauptmenü */
.userbar {
    position: fixed;
    top: 3.7rem;
    left: 0;
    right: 0;
    z-index: 999;
    min-height: 2rem;
    padding: 0.28rem 1rem;
    background: #e9f2f9;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 0.9rem;
    text-align: right;
    box-shadow: 0 2px 8px #0b4f8a12;
}

.userbar a,
.userbar a:visited,
.userbar a:active {
    color: var(--blue);
    text-decoration: none;
    font-weight: 650;
}

.userbar a:hover {
    text-decoration: underline;
}

/* =========================================================
   UNTERMENÜS (KUNDEN-SUBNAV & CARD-SUBNAV)
   ========================================================= */

/* Flexibler Container für das Untermenü */
.subnav,
.card.card-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--blue);
    border: 1px solid var(--blue);
    box-shadow: 0 2px 8px #002b4d22;
    overflow: hidden;
    padding: 0;
    margin: 0px;
}

.subnav a,
.card.card-subnav a {
    display: flex;
    align-items: center;
    min-height: 2.9rem;
    padding: 0 0.85rem;
    border-right: 1px solid rgba(255,255,255,0.18);
    background: var(--blue);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.subnav a.active,
.subnav a:hover,
.card.card-subnav a.active,
.card.card-subnav a:hover {
    background: #fff !important;
    color: var(--blue) !important;
}

.subnav a:visited,
.card.card-subnav a:visited {
    color: #fff !important;
}

.subnav a.active:visited,
.subnav a:hover:visited,
.card.card-subnav a.active:visited,
.card.card-subnav a:hover:visited {
    color: var(--blue) !important;
}

/* Der Spacer füllt freien Raum aus und schiebt Elemente nach rechts */
.subnav .subnav-spacer,
.card.card-subnav .subnav-spacer {
    background: var(--blue);
    min-height: 2.9rem;
    flex: 1 1 auto;
}

/* Styling für den Aktions-Button rechtsbündig */
.subnav .kundendetail-taetigkeit-btn,
.card.card-subnav .kundendetail-taetigkeit-btn {
    display: flex;
    align-items: center;
    min-height: 2.9rem;
    padding: 0 1rem;
    background: var(--blue);
    color: #fff;
    border: 0;
    border-left: 1px solid rgba(255,255,255,0.18);
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 0;
}

.subnav .kundendetail-taetigkeit-btn:hover,
.card.card-subnav .kundendetail-taetigkeit-btn:hover {
    background: #fff;
    color: var(--blue);
}

.danger-subnav,
.aktualisierung-nav {
    background: #b91c1c !important;
    color: #fff !important;
}

.danger-subnav:hover,
.danger-subnav.active,
.aktualisierung-nav:hover,
.aktualisierung-nav.active {
    background: #fff !important;
    color: #b91c1c !important;
}

/* =========================================================
   LAYOUT & STRUKTUR
   ========================================================= */

.container {
    max-width: none;
    width: 90%;
    margin: 7.1rem auto 2rem;
    padding: 0;
}

h1 {
    font-size: 1.75rem;
    margin: 0;
}

h1.card {
    margin: 0;
    padding: 1rem;
}

h2 {
    font-size: 1.25rem;
    margin: 0;
    padding-bottom: 0.5rem;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    padding: 1rem;
    box-shadow: 0 4px 16px #0b4f8a12;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.report-page {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================================
   FORMULARE, FILTERZEILEN & BUTTONS
   ========================================================= */

label {
    display: block;
    font-weight: 650;
    margin-bottom: 0.35rem;
}

input,
select {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border: 1px solid #bfd4e5;
    padding: 0.72rem;
    line-height: 1.2;
    background: #fff;
    font: inherit;
    color: var(--text);
}

textarea {
    width: 100%;
    min-height: 48px;
    height: auto;
    border: 1px solid #bfd4e5;
    padding: 0.72rem;
    line-height: 1.2;
    background: #fff;
    font: inherit;
    color: var(--text);
    resize: vertical;
}
      
textarea.textarea-large {
    min-height: 192px;
}

select {
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    height: auto;
    padding: 0;
}

input[type="file"] {
    padding: 0.55rem;
    height: auto;
    min-height: 48px;
}

button,
.btn {
    border: 0;
    padding: 0.75rem 1rem;
    background: var(--blue2);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 650;
    display: inline-block;
    font-size: 1rem;
}

button:hover,
.btn:hover {
    filter: brightness(0.95);
}

button:disabled {
    background: #98aabb;
    cursor: not-allowed;
}

.danger-button {
    background: #b42318;
    color: #fff;
}

button.secondary {
    background: #e5edf5;
    color: var(--text);
}

.text-link-button { 
    background: none !important; 
    border: 0 !important; 
    color: #0b4f8a !important; 
    padding: 0 !important; 
    text-decoration: underline; 
    cursor: pointer; 
    font: inherit; 
}

.help {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.35rem 0;
}

.dashboard-info .help {
    color: var(--muted);
    font-size: 1rem;
    margin: 0.35rem 0;
    font-weight: 500;
}

/* Einzeilige, flexible Formular-Filterzeilen */
.nachweise-report-filter .grid,
.nachweise-overview-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
}

.nachweise-report-filter .grid > div,
.nachweise-overview-filter-row > div {
    flex: 0 0 auto;
    width: auto;
    min-width: 11rem;
}

.nachweise-report-filter select, 
.nachweise-report-filter input:not([type="checkbox"]):not([type="radio"]), 
.nachweise-overview-filter select, 
.nachweise-overview-filter input:not([type="checkbox"]):not([type="radio"]), 
.unterweisung-vorlage-form select, 
.unterweisung-vorlage-form input:not([type="checkbox"]):not([type="radio"]) { 
  width: auto; 
  min-width: 11rem; 
}

.nachweise-filter-action,
.nachweise-overview-actions,
.unterweisung-vorlage-action {
    display: flex;
    align-items: end;
    gap: 0.5rem;
    width: auto;
    flex: 0 0 auto;
}

.nachweise-overview-actions .btn,
.nachweise-overview-actions button,
.nachweise-filter-action button,
.unterweisung-vorlage-action button {
    white-space: nowrap;
}

.vorlagen-row {
    display: flex;
    flex-wrap: wrap; 
    gap: 15px;       
    align-items: flex-end; 
}

.vorlagen-row > div {
    flex: 1;
    min-width: 200px; 
}

.vorlagen-row select, 
.vorlagen-row button {
    width: 100%;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
}

/* =========================================================
   TABELLEN & BADGES
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 0;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

th {
    background: var(--soft);
    cursor: pointer;
}

tr:hover td {
    background: #f4f9ff;
}

.clickrow {
    cursor: pointer;
}

.sumrow td {
    font-weight: 800;
    background: #f1f8ff;
}

.badge {
    display: inline-block;
    background: #e0f2fe;
    color: #075985;
    padding: 0.18rem 0.55rem;
    font-size: 0.85rem;
}

.table-wrap a {
    color: var(--blue);
    font-weight: 650;
    text-decoration: none;
}

.table-wrap a:hover {
    text-decoration: underline;
}

.participants-table input {
    min-width: 160px;
}

.export-import-row {
    background: #e8f5e9;
}

.export-table th,
.export-table td,
.export-summary-table th,
.export-summary-table td {
    white-space: nowrap;
}

.export-table th:nth-child(4),
.export-table td:nth-child(4) {
    white-space: normal;
}

.export-table-toggle > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: .75rem;
}

.table-wrap .inline-form input,
.table-wrap .inline-form select,
.table-wrap .inline-form textarea {
    width: auto;
}

.taetigkeit-year-group {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    overflow: hidden;
    background: #fff;
}

.taetigkeit-year-title {
    padding: 0.9rem 1rem;
    font-weight: 700;
    cursor: pointer;
    background: #eef4fa;
}

.taetigkeit-jahr-table-wrap table.taetigkeit-jahr-table {
    width: 100%;
    table-layout: fixed;
}

.taetigkeit-jahr-table th,
.taetigkeit-jahr-table td {
    width: 12.5%;
}

.taetigkeit-jahr-table td:nth-child(8),
.taetigkeit-jahr-table th:nth-child(8) {
    white-space: normal !important;
    overflow-wrap: anywhere;
}

/* =========================================================
   HINWEISE, STATUSAUSZEICHNUNGEN & ROLLEN
   ========================================================= */

.alert {
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    border: 1px solid;
}

.alert.ok {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alert.error {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.positive-value {
    color: #166534;
    background: #f0fdf4;
    font-weight: 700;
}

.negative-value {
    color: #9a3412;
    background: #fff7ed;
    font-weight: 700;
}

.inactive-row td,
.contract-warning-row td {
    background: #fff7ed;
    color: #9a3412;
}

.contract-warning-row a {
    color: #9a3412;
    font-weight: 800;
}

.question-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-weight: 700;
    font-size: 0.85rem;
}

.question-status-erstellt {
    background: #f3f4f6;
    color: #4b5563;
}

.question-status-geprüft {
    background: #fff7ed;
    color: #9a3412;
}

.question-status-freigegeben {
    background: #f0fdf4;
    color: #166534;
}

.rollenmodell-hinweis table {
    width: 100%;
}
.rollenmodell-hinweis code {
    white-space: nowrap;
}

/* =========================================================
   DIAGRAMME (SVG / BARS / KPI)
   ========================================================= */

.kpi {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.kpi .card strong {
    font-size: 1.5rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    min-height: 270px;
    padding: 1rem 0.5rem;
    overflow-x: auto;
}

.bar-year {
    min-width: 115px;
    text-align: center;
}

.bar-area {
    height: 190px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid var(--line);
}

.bar-group {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
}

.bar {
    width: 28px;
}

.bar-soll {
    background: #d1d5db;
}

.bar-ist-positive {
    background: #bbf7d0;
}

.bar-ist-negative {
    background: #fed7aa;
}

.chart-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-positive {
    background: #fff4e8;
    color: #166534;
    padding: .6rem;
}

.summary-negative {
    background: #edf8ef;
    color: #9a3412;
    padding: .6rem;
}

.revenue-total {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--blue);
    margin: 0.25rem 0 0;
}

.line-chart-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.line-chart {
    width: 100%;
    height: auto;
    display: block;
}

.chart-axis {
    stroke: #d6e6f2;
    stroke-width: 2;
}

.chart-line {
    fill: none;
    stroke: #0e68b1;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    fill: #0e68b1;
}

.chart-label {
    fill: #5f7182;
    font-size: 14px;
}

.chart-value {
    fill: #102a43;
    font-size: 13px;
    font-weight: 700;
}

.chart-bar-blue {
    fill: #0b4f8a !important;
    stroke: #0b4f8a !important;
    stroke-width: 1.5;
    rx: 5;
}

.chart-bar-green {
    fill: #2ecc71 !important;
    stroke: #2ecc71 !important;
    stroke-width: 1.5;
    rx: 5;
}

.legend-blue { background-color: #0b4f8a !important; }
.legend-green { background-color: #2ecc71 !important; }

.chart-line-blue { stroke: #0b4f8a !important; }
.chart-line-green { stroke: #2ecc71 !important; }

.chart-point-blue { fill: #0b4f8a !important; }
.chart-point-green { fill: #2ecc71 !important; }

/* =========================================================
   LOGIN, MODALS & INTERNE SUCHE
   ========================================================= */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #0b4f8a, #e8f5ff);
}

.loginbox {
    max-width: 420px;
    width: 100%;
    background: #fff;
    padding: 1.4rem;
    box-shadow: 0 20px 60px #00345f33;
}

.loginbox .login-daily-spruch {
    font-size: 0.82rem;
    line-height: 1.4;
    margin-top: -0.25rem;
    margin-bottom: 0.75rem;
}

.login-layout-anker {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(280px, 420px);
    gap: 1.25rem;
    align-items: stretch;
    width: min(920px, calc(100% - 2rem));
    margin: 0 auto;
}

.login-layout-anker .loginbox {
    margin: 0;
    width: 100%;
    max-width: none;
}

.login-anker-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-anker-info p {
    margin: 0.25rem 0;
    font-size: 1.08rem;
    line-height: 1.35;
}

.login-anker-info strong {
    font-size: 1.22em;
    color: var(--blue);
    font-weight: 800;
}

.login-anker-info hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1rem 0;
}

.modal-backdrop[hidden],
.search-modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-card {
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.25);
    max-width: 420px;
    width: 100%;
    padding: 1.25rem;
}

.modal-card h2 {
    margin-top: 0;
}

.modal-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

body.modal-open {
    overflow: hidden;
}

.customer-activity-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.customer-activity-dialog {
    background: #fff;
    width: min(1100px, 96vw);
    height: min(820px, 92vh);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.customer-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    background: var(--blue);
    color: #fff;
}

.customer-activity-close {
    background: transparent;
    color: #fff;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    padding: 0.1rem 0.45rem;
    cursor: pointer;
}

.customer-activity-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f7fbff;
}

.search-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 4000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 1rem 1rem;
}

.search-dialog {
    width: min(720px, 96vw);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
    padding: 1rem;
}

.search-dialog-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.search-dialog-head h2 {
    margin: 0;
}

.search-close {
    border: 0;
    background: #e5edf5;
    color: var(--text);
    font-size: 1.3rem;
    width: 2.3rem;
    height: 2.3rem;
    cursor: pointer;
}

.search-suggestions {
    display: grid;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.search-suggestion {
    display: block;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line);
    padding: 0.6rem 0.75rem;
    background: #f8fbff;
}

.search-suggestion:hover {
    background: #eef6fc;
}

.search-suggestion small {
    display: block;
    color: var(--muted);
    margin-top: 0.15rem;
}

/* =========================================================
   DETAILRASTER & VERTRAGSMETA
========================================================= */

.detail-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0.35rem 1rem;
}

.detail-grid div {
    padding: 0.35rem 0;
    border-bottom: 1px solid #edf4fa;
}

.smallprint {
    font-size: 0.78rem;
    color: #465a69;
    line-height: 1.45;
    margin-top: 1rem;
}

.contract-status-actions {
    border: 1px solid var(--line);
    background: #f8fbff;
    padding: 1rem;
    margin: 1rem 0;
}

.contract-status-actions h3 {
    margin-top: 0;
}

/* =========================================================
   DASHBOARD-STEUERUNG & INTERNE LAYOUTS
   ========================================================= */

.dashboard-intro h2 {
    margin-bottom: 0.35rem;
}

.dashboard-spruch {
    margin: 0;
    color: #475569;
    font-style: italic;
}

.dashboard-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.dashboard-card-head h2 {
    margin: 0;
}

.dashboard-status {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
}

.dashboard-ok {
    background: #f0fdf4;
    color: #166534;
}

.dashboard-risk {
    background: #fff7ed;
    color: #9a3412;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dashboard-kpis div {
    border: 1px solid var(--line);
    padding: 0.75rem;
    background: #f8fbff;
}

.dashboard-kpis strong {
    display: block;
    font-size: 1.25rem;
}

.dashboard-kpis span {
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-bar-block {
    margin: 0;
    grid-column: 1 / -1; 
}

.dashboard-bar-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.dashboard-bar-label span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-bar {
    height: 0.85rem;
    background: #e5edf5;
    overflow: hidden;
}

.dashboard-bar-fill {
    height: 100%;
}

.dashboard-fill-blue { background: #0e68b1; }
.dashboard-fill-green { background: #bbf7d0; }
.dashboard-fill-orange { background: #fed7aa; }

.dashboard-info-text {
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Begrüßungs-Layout */
.dashboard-welcome-layout {
    display: flex;
    align-items: center; 
    gap: 20px;           
    width: 100%;         
}

.dashboard-welcome-logo {
    flex-shrink: 0;      
}

.dashboard-welcome-action {
    margin-left: auto;   
    display: flex;       
    gap: 10px;           
}

.dashboard-action-btn {
    width: 200px;
    text-align: center;
}

/* ASA Warnkarten */
.dashboard-asa-warning {
    background: #fff7ed;
    border-color: #fed7aa;
}

.dashboard-asa-warning h2 {
    color: #9a3412;
}

.dashboard-asa-details {
    margin-top: 0.75rem;
}

.dashboard-asa-details summary {
    cursor: pointer;
    font-weight: 700;
}

/* Aufklappbare Blöcke (Collapse) */
.dashboard-info-card {
    margin-top: 1rem;
}

.dashboard-collapse-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.dashboard-collapse-summary::-webkit-details-marker {
    display: none;
}

.dashboard-collapse-name {
    font-size: 1.15rem;
    font-weight: 800;
}

.dashboard-collapse-content {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
    align-items: stretch;
    gap: 0.85rem;
}

.dashboard-kpi-single {
    min-width: 0;
}

.dashboard-kpi-single strong {
    font-size: 1.25rem;
}

.dashboard-kpi-single span {
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-element[data-element="details"] {
    grid-column: 1 / -1;
    white-space: nowrap;
}

/* Drag & Drop Listen */
.dashboard-layout-card {
    margin-bottom: 1rem;
}

.dashboard-layout-list {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.dashboard-layout-item {
    display: block;
    width: 16rem;
    max-width: 100%;
    flex: 0 0 16rem;
    border: 1px solid var(--line);
    background: #f8fbff;
    white-space: nowrap;
    padding: 0.55rem 0.7rem;
    cursor: grab;
}

.dashboard-layout-item input,
.dashboard-layout-item span {
    vertical-align: middle;
}

.dashboard-layout-item.dragging {
    opacity: 0.55;
}

.drag-handle {
    color: var(--muted);
    font-weight: 900;
    margin-right: 0.35rem;
}

/* Inline-Editor */
.dashboard-info-editable {
    min-height: 3.5rem;
    border: 1px dashed transparent;
    padding: 0.65rem;
}

.dashboard-info-editable.is-editing {
    border-color: #0b4f8a;
    background: #f8fbff;
    outline: none;
}

.dashboard-info-editable:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.dashboard-info-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.5rem 0;
}

.dashboard-info-toolbar button {
    padding: 0.35rem 0.6rem;
}

.dashboard-info-blue { color: #0b4f8a; font-weight: 600; }
.dashboard-info-green { color: #166534; font-weight: 600; }
.dashboard-info-orange { color: #9a3412; font-weight: 600; }

.dashboard-welcome {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fbff;
    border: 1px solid #dbe7f3;
}

.dashboard-welcome h2 {
    margin: 0 0 0.35rem;
}

/* =========================================================
   AUSBILDUNG / PRÜFUNGSBÖGEN
   ========================================================= */

.exam-page {
    background: #fff;
    border: 1px solid var(--line);
    padding: 1.2rem;
    margin: 1rem auto;
    max-width: 980px;
    page-break-after: always;
    break-after: page;
}

.exam-page h1 {
    margin-top: 0;
}

.exam-warning {
    color: #b42318;
    font-weight: 800;
}

.exam-meta,
.exam-person {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 0.35rem 1rem;
    margin: 1rem 0;
}

.exam-person {
    border: 1px solid #9aaabd;
}

.exam-person div {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #d6e6f2;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.exam-answer-table {
    min-width: 0;
    width: 100%;
    border-collapse: collapse;
}

.exam-answer-table td {
    border: 1px solid #9aaabd;
    padding: 0.25rem 0.35rem;
    text-align: center;
    white-space: nowrap;
}

.exam-answer-table td:first-child {
    text-align: left;
    width: 80px;
}

.correct-answer {
    background: #eef6fc;
    font-weight: 900;
    outline: 2px solid #0b4f8a;
}

.exam-declaration {
    margin-top: 2rem;
}

.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 2rem;
    margin-top: 1.5rem;
}

.signature-grid .line {
    border-bottom: 1px solid #333;
    height: 2rem;
}

.result-grid {
    display: grid;
    grid-template-columns: 160px 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-top: 2rem;
}

.question-block {
    margin: 0;
    break-inside: avoid;
}

.question-block div {
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.exam-result-table {
    width: 100%;
    min-width: 0;
    margin-top: 2rem;
    border-collapse: collapse;
}

.exam-result-table th,
.exam-result-table td {
    border: 1px solid #9aaabd;
    padding: 0.6rem;
    height: 2.4rem;
    vertical-align: middle;
}

.exam-result-table th {
    width: 140px;
    background: #eef6fc;
    text-align: left;
}

.exam-result-table td:nth-child(2) {
    width: 180px;
}

.question-id {
    font-size: 0.72em;
    color: #7a8794;
    font-weight: 400;
}

.pruefung-check {
    width: auto;
}

.answers-edit {
    display: grid;
    gap: 0.75rem;
}

.answer-edit-row {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 1rem;
    align-items: end;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ========================================================= */

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

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

    .dashboard-card-head,
    .dashboard-bar-label {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 760px) {
    .menu-toggle {
        display: block;
        margin-left: auto;
    }

    .navlinks {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 3.7rem;
        background: var(--blue);
        padding: 0.5rem 0;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        height: auto;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }

    .navlinks.open {
        display: flex;
    }

    .navlinks a {
        justify-content: flex-start;
        padding: 1rem 1.5rem;
        border-left: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        min-height: auto;
    }
    
    .navlinks #open-search-modal,
    .navlinks a[href="suche.php"],
    .navlinks a[href="hilfe.php"] {
        justify-content: flex-start;
        font-size: 1rem !important;
    }

    .container {
        width: 94%;
        margin-top: 6.5rem; /* Genug Platz für fixiertes Menü + Userbar auf Mobilgeräten */
    }

    .grid,
    .kpi,
    .chart-summary {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .userbar {
        text-align: left;
    }

    h1 {
        font-size: 1.45rem;
    }

    table,
    .line-chart {
        min-width: 720px;
    }

    .subnav,
    .card.card-subnav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .subnav a,
    .subnav .kundendetail-taetigkeit-btn,
    .card.card-subnav a,
    .card.card-subnav .kundendetail-taetigkeit-btn {
        flex: 0 0 auto;
    }

    .subnav .subnav-spacer,
    .card.card-subnav .subnav-spacer {
        display: none; /* Spacer verschwindet mobil, um Platz zu sparen */
    }

    .login-layout-anker {
        grid-template-columns: 1fr;
        width: min(420px, calc(100% - 2rem));
    }

    .dashboard-welcome-layout {
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px;
    }

    .dashboard-welcome-action {
        margin-left: 0; 
        width: 100%;
        flex-direction: column;
    }

    .dashboard-action-btn {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .dashboard-kpis {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   DRUCKANPASSUNG (OPTIMIERT & KONFLIKTFREI)
   ========================================================= */

@media print {
    .topnav,
    .userbar,
    .footer,
    .no-print,
    form,
    h1,
    .btn,
    nav,
    header {
        display: none !important;
    }

    html, body {
        background: #fff;
        font-size: 10pt !important;
        line-height: 1.3 !important;
    }

    body, table, p, span, div, li, input, textarea, select {
        font-size: 8pt !important;
    }

    th {
        font-size: 9pt !important;
        font-weight: 700 !important;
        background: var(--soft) !important;
    }

    td {
        font-size: 8pt !important;
    }

    .container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .card,
    .table-wrap,
    .report-page {
        box-shadow: none;
        border: 0;
        max-width: none;
        margin: 0;
    }

    table {
        min-width: 0 !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }
   
    td.nowrap,
    th.nowrap,
    .nowrap {
        white-space: nowrap !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
        hyphens: none !important;
    }

    h1 {
        font-size: 16pt !important;
        line-height: 1.2 !important;
        margin-bottom: 0.6rem !important;
    }

    h2 {
        font-size: 14pt !important;
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
    }

    h3 {
        font-size: 12pt !important;
        line-height: 1.2 !important;
        margin-bottom: 0.4rem !important;
    }

    h4, h5, h6 {
        font-size: 10pt !important;
        line-height: 1.2 !important;
    }

    /* Prüfungsspezifische Print-Regeln */
    .exam-page {
        border: 0;
        padding: 0;
        margin: 0;
        max-width: none;
        page-break-after: always;
        break-after: page;
    }

    .exam-cover,
    .exam-solution,
    .exam-questions {
        page-break-after: always;
        break-after: page;
    }

    .exam-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .exam-answer-table td {
        font-size: 12px !important;
        padding: 0.18rem 0.25rem;
    }

    .question-block,
    .question-block div,
    .question-block strong {
        font-size: 12px !important;
    }
}


/* 1. Erste Zeile des Tabellenkopfs: Klebt direkt unter dem Hauptmenü */
.table-wrap table thead tr:first-child th,
table.sortable thead tr:first-child th,
.bda-table thead tr:first-child th {
    position: sticky !important;
    top: 5.7rem !important; /* Höhe deines Menüs (3.7rem + 2rem) */
    z-index: 101 !important;
    background: #f8fafc;
}

/* 2. Zweite Zeile des Tabellenkopfs: Klebt direkt unter der ersten Zeile */
.table-wrap table thead tr:nth-child(2) th,
table.sortable thead tr:nth-child(2) th,
.bda-table thead tr:nth-child(2) th {
    position: sticky !important;
    top: calc(5.7rem + 2.35rem) !important; /* Menühöhe + geschätzte Höhe der 1. TH-Zeile */
    z-index: 100 !important;
    background: #f8fafc;
}

/* 3. Wichtig: Die Elternelemente müssen das Mitscrollen erlauben */
.table-wrap, 
.bda-table-wrap,
.customer-field-group,
.card {
    overflow: visible !important;
}
