:root {
    /* =========================================================
       NFD – A) ZENTRALE FACHLICHE AKZENTFARBEN
       ========================================================= */

    /* Gruppenpraxis */
    --nfd-group-bg: #e3e8f7;
    --nfd-group-header-bg: #cfd8f1;
    --nfd-group-hover-bg: #d9e1f4;
    --nfd-group-border: #2f5fa8;

    /* Dispensation – transparente Ebene über der Grundfarbe */
    --nfd-dispensation-overlay: rgba(35, 153, 139, .25);
    --nfd-dispensation-overlay-hover: rgba(35, 153, 139, .32);

    /* Manuell angepasst – nur betroffene DP-Zelle */
    --nfd-manual-overlay: rgba(184, 70, 126, .20);
    --nfd-manual-border: rgba(150, 65, 115, .18);

    /* Cave */
    --nfd-cave-bg: #fff0ad;
    --nfd-cave-border: #d7b849;
    --nfd-cave-symbol: #a63232;

    /* Status */
    --nfd-status-regular: #3c6c44;
    --nfd-status-manual: #8b3f67;
    --nfd-status-dispensation: #496c69;

    /* Alter */
    --nfd-age-60-bg: #f7f2df;
    --nfd-age-65-bg: #f5e5c9;
    --nfd-age-70-bg: #f3d2cf;
    --nfd-age-missing-bg: #f4b8b5;
    --nfd-age-missing-text: #8d2020;
    --nfd-missing-soft-bg: rgba(239, 190, 88, .16);
    --nfd-missing-soft-border: rgba(171, 116, 0, .18);

    /* Zeitebenen Ärzteliste/Kombiliste */
    --nfd-freeze-bg: #f4f6f7;
    --nfd-freeze-header-bg: #e8ecef;
    --nfd-current-bg: #fafbfc;
    --nfd-current-header-bg: #f0f3f5;
    --nfd-upcoming-bg: #fff6f1;
    --nfd-upcoming-header-bg: #f8e8df;
    --nfd-comments-bg: #fbfaf7;
    --nfd-comments-header-bg: #f2efe8;


    /* =========================================================
       NFD – B) ZENTRALE ALLGEMEINE LAYOUT-/BASISFARBEN
       ========================================================= */

    --font-ui: "Segoe UI", Arial, sans-serif;
    --font-size-ui: 12.5px;
    --font-size-table: 12px;
    --row-height: 31px;
    --sidebar-width: 215px;

    --border: #d7dde4;
    --border-strong: #c4ccd5;

    --surface: #ffffff;
    --surface-soft: #f5f7fa;
    --surface-header: #edf1f5;
    --surface-row-alt: #fafbfc;
    --surface-row-hover: #eef5f9;

    --text: #26313d;
    --text-muted: #6a7683;
    --text-heading: #26313d;
    --text-link: #245f86;

    --sidebar: #243a4a;
    --sidebar-text: #dfe8ee;
    --sidebar-muted: #8fa6b5;

    --plan-bg: #f6f9fb;
    --live-bg: #ffffff;
    --historical-bg: #f0f1f3;

    --age60: var(--nfd-age-60-bg);
    --age65: var(--nfd-age-65-bg);
    --age70: var(--nfd-age-70-bg);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-ui);
    font-size: var(--font-size-ui);
    color: var(--text);
    background: var(--surface-soft);
}
button, input { font: inherit; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-text);
}
.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 17px 15px 15px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 37px; height: 37px;
    border-radius: 6px;
    background: #e9f3f8;
    color: #235f84;
    font-weight: 800;
}
.brand-title { font-weight: 700; font-size: 13.5px; }
.brand-subtitle { margin-top: 2px; font-size: 10.5px; color: var(--sidebar-muted); }

.nav { padding: 9px 7px; }
.nav-section {
    padding: 12px 9px 5px;
    color: var(--sidebar-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.nav-item {
    display: block;
    width: 100%;
    margin: 1px 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--sidebar-text);
    text-align: left;
    text-decoration: none;
}
.nav-item.active { background: rgba(255,255,255,.13); font-weight: 650; }
.nav-item.disabled { color: #758d9d; }
.sidebar-footer {
    margin-top: auto;
    padding: 10px 15px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-version {
    display: inline-block;
    color: var(--sidebar-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .025em;
    text-decoration: none;
    opacity: .82;
}
.sidebar-version:hover { opacity: 1; text-decoration: underline; }

.main { min-width: 0; }

.topbar {
    min-height: 66px;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
    align-items: center;
    padding: 7px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0 0 3px; font-size: 19px; }
.subtitle { color: var(--text-muted); font-size: 11px; }

.period-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}
.period-label { min-width: 285px; text-align: center; }
.period-name { font-size: 19px; line-height: 1.15; font-weight: 700; }
.period-dates { margin-top: 3px; color: var(--text-muted); font-size: 11.5px; }

.period-arrow {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 31px;
    padding: 0 10px;
    border: 1px solid #aeb9c4;
    border-radius: 5px;
    color: #314757;
    background: linear-gradient(#ffffff, #edf1f4);
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.period-arrow:hover:not(.disabled) { background: #e9eef3; }
.period-arrow.disabled { color: #b2bac2; background: #fafafa; }

.toolbar {
    min-height: 45px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 7px 18px;
    border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; min-width: 280px; max-width: 430px; flex: 1; }
.search-icon { position: absolute; left: 9px; top: 5px; color: var(--text-muted); }
.search-wrap input {
    width: 100%;
    height: 31px;
    padding: 0 10px 0 29px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
}
.legend { display: flex; gap: 12px; color: var(--text-muted); font-size: 11px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-r { background: var(--nfd-status-regular); }
.status-m { background: var(--nfd-status-manual); }
.status-d { background: var(--nfd-status-dispensation); }
.record-count { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.table-card {
    margin: 13px 18px 18px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    overflow: hidden;
}
.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 155px);
}
.data-grid {
    min-width: 1820px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-table);
    white-space: nowrap;
}
.data-grid th, .data-grid td {
    height: var(--row-height);
    padding: 4px 7px;
    border-right: 1px solid #e3e7eb;
    border-bottom: 1px solid #dfe4e8;
    vertical-align: middle;
}
.data-grid th:last-child, .data-grid td:last-child { border-right: 0; }
.data-grid thead th {
    position: sticky;
    top: 24px;
    z-index: 3;
    background: var(--surface-header);
    color: #3d4d5b;
    font-size: 11px;
    font-weight: 650;
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
}
.data-grid thead .group-row th {
    top: 0;
    height: 24px;
    padding: 3px 7px;
    font-size: 9.5px;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: center;
    color: #677583;
}
.group-person { background: #edf1f5 !important; }
.group-plan { background: #eaf1f6 !important; }
.group-live { background: #f3f5f7 !important; }
.group-inactive { background: #e8eaed !important; color: #999 !important; }

.data-grid th.sortable { cursor: pointer; user-select: none; }
.data-grid th.sortable:hover { background: #e1e7ed; }

.data-grid tbody tr:nth-child(even) { background: #fafbfc; }
.data-grid tbody tr:hover { background: #eef5f9; }
.data-grid tbody tr.hidden { display: none; }

.center { text-align: center !important; }
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }
.tiny { width: 42px; }
.age-col { width: 62px; }
.fee-col { width: 95px; }
.next-plan-col { min-width: 118px; }

/* Excel-artige Fixierung der ersten drei Spalten */
.data-grid th:nth-child(1), .data-grid td:nth-child(1) { width: 46px; min-width: 46px; max-width: 46px; }
.data-grid th:nth-child(2), .data-grid td:nth-child(2) { width: 138px; min-width: 138px; max-width: 138px; }
.data-grid th:nth-child(3), .data-grid td:nth-child(3) { width: 112px; min-width: 112px; max-width: 112px; }

.sticky-col {
    position: sticky;
    z-index: 4;
    background: inherit;
}
.sticky-col-1 { left: 0; }
.sticky-col-2 { left: 46px; }
.sticky-col-3 {
    left: 184px;
    box-shadow: 2px 0 3px rgba(0,0,0,.08);
}
.data-grid thead .sticky-col {
    z-index: 7;
    background: var(--surface-header);
}

/* Fixierte Spalten müssen undurchsichtig sein, damit dahinter scrollender Text
   nicht durchscheint. */
.data-grid tbody td.sticky-col {
    background: #ffffff;
}
.data-grid tbody tr:nth-child(even) td.sticky-col {
    background: #fafbfc;
}
.data-grid tbody tr:hover td.sticky-col {
    background: #eef5f9;
}
.data-grid tbody tr.is-dispensated td.sticky-col {
    background: #e2efed !important;
}
.data-grid tbody tr.is-dispensated:hover td.sticky-col {
    background: #d9e9e7 !important;
}

/* Dispensation: ganze Zeile dezent petrolfarben */
.data-grid tbody tr.is-dispensated td {
    background: #e2efed !important;
}
.data-grid tbody tr.is-dispensated:hover td {
    background: #d9e9e7 !important;
}

/* Manuelle Anpassung: nur die betroffene Dienstpensum-Zelle */
.manual-adjusted-cell {
    background: #f6dfe9 !important;
    box-shadow: inset 0 0 0 1px rgba(150, 65, 115, .14);
}

.code-cell { font-weight: 700; color: #41596a; }
.doctor-name { font-weight: 650; color: var(--text-link); }
.specialty-cell { width:96px; min-width:96px; max-width:96px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.plan-cell { background: rgba(231,240,246,.35); }
.strong { font-weight: 750; }

.live-head { background: #f3f5f7 !important; }
.live-cell { background: rgba(247,248,250,.65); }
.inactive-head { background: #e8eaed !important; color: #999 !important; }
.inactive-cell {
    background: var(--historical-bg) !important;
    color: #a2a7ad !important;
}

.status-code {
    width: 34px;
    font-weight: 800;
}
.status-r { color: var(--nfd-status-regular); }
.status-m { color: var(--nfd-status-manual); background: transparent !important; }
.status-d { color: var(--nfd-status-dispensation); background: transparent !important; }

.age-cell { font-variant-numeric: tabular-nums; }
.age-60 { background: var(--age60) !important; }
.age-65 { background: var(--age65) !important; font-weight: 650; }
.age-70 { background: var(--age70) !important; font-weight: 750; }
.age-missing { background:var(--nfd-age-missing-bg) !important; color:var(--nfd-age-missing-text) !important; font-weight:800; box-shadow:inset 0 0 0 1px rgba(145,32,32,.22); }

.notes-cell {
    width: 430px;
    min-width: 430px;
    max-width: 430px;
    color: #5e6c78;
    white-space: nowrap;
}
.doctor-grid th.notes-head {
    width: 430px;
    min-width: 430px;
    max-width: 430px;
}
.snapshot-note {
    background: #f0f1f3 !important;
    color: #606870;
}
.snapshot-note-head { background: #e8eaed !important; }

.next-plan-cell { font-weight: 650; color: #3d607a; }

.demo-time-note {
    position: fixed;
    right: 12px;
    bottom: 10px;
    padding: 6px 9px;
    border: 1px solid #d5c286;
    border-radius: 4px;
    background: #fff8dd;
    color: #735d18;
    font-size: 10.5px;
    box-shadow: 0 2px 7px rgba(0,0,0,.08);
}
.demo-time-note a { color: inherit; }

@media (max-width: 1000px) {
    :root { --sidebar-width: 180px; }
    .topbar { grid-template-columns: 1fr; gap: 8px; }
    .topbar-title, .topbar-spacer { display: none; }
    .legend { display: none; }
    .table-scroll { max-height: none; }
}

/* ==========================================================
   Praxisliste v0.3
   ========================================================== */
.practice-grid { min-width: 1250px; }
.practice-grid th:nth-child(1), .practice-grid td:nth-child(1) { width: 46px; min-width: 46px; max-width: 46px; }
.practice-grid th:nth-child(2), .practice-grid td:nth-child(2) { width: 235px; min-width: 235px; max-width: 235px; }
.practice-grid th:nth-child(3), .practice-grid td:nth-child(3) { min-width: 190px; }
.practice-grid th:nth-child(4), .practice-grid td:nth-child(4) { min-width: 150px; }
.practice-grid th:nth-child(5), .practice-grid td:nth-child(5) { min-width: 120px; }
.practice-grid th:nth-child(6), .practice-grid td:nth-child(6) { min-width: 100px; }
.practice-grid th:nth-child(7), .practice-grid td:nth-child(7) { width: 54px; min-width: 54px; max-width: 54px; }
.practice-grid th:nth-child(8), .practice-grid td:nth-child(8) { min-width: 380px; }

.p-sticky { position: sticky; z-index: 4; }
.p-sticky-1 { left: 0; }
.p-sticky-2 { left: 46px; box-shadow: 2px 0 3px rgba(0,0,0,.08); }
.practice-grid thead .p-sticky { z-index: 7; background: var(--surface-header); }
.practice-grid tbody td.p-sticky { background: #fff; }
.practice-grid tbody tr:nth-child(even) td.p-sticky { background: #fafbfc; }
.practice-grid tbody tr:hover td.p-sticky { background: #eef5f9; }

.practice-name { font-weight: 650; color: var(--text-link); }
.informative-dp { font-weight: 400; color: #68747f; }
.doctors-cell {
    min-width: 380px;
    white-space: nowrap;
    color: #53616d;
}


/* ==========================================================
   v0.4 – Cave + Kombiliste
   ========================================================== */
.cave-cell { width: 46px; min-width: 46px; }
.cave-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 4px;
    background: var(--nfd-cave-bg); border: 1px solid var(--nfd-cave-border);
    color: var(--nfd-cave-symbol); font-weight: 850; font-size: 13px; line-height: 1;
}
.region-filter { display:flex; gap:4px; }
.filter-btn {
    height: 29px; min-width: 34px; padding: 0 8px;
    border:1px solid #b9c3cc; border-radius:4px; background:#fff;
    color:#4b5d6b; font-size:11px; font-weight:650; cursor:pointer;
}
.filter-btn:hover { background:#eef3f6; }
.filter-btn.active { background:#dfeaf1; border-color:#91a8b8; color:#244f6b; }
.combo-grid { min-width: 1880px; }
.combo-grid th:nth-child(1), .combo-grid td:nth-child(1) { width:46px; min-width:46px; max-width:46px; }
.combo-grid th:nth-child(2), .combo-grid td:nth-child(2) { width:150px; min-width:150px; max-width:150px; }
.combo-grid th:nth-child(3), .combo-grid td:nth-child(3) { width:115px; min-width:115px; max-width:115px; }
.c-sticky { position:sticky; z-index:4; }
.c-sticky-1 { left:0; }
.c-sticky-2 { left:46px; }
.c-sticky-3 { left:196px; box-shadow:2px 0 3px rgba(0,0,0,.08); }
.combo-grid thead .c-sticky { z-index:7; background:var(--surface-header); }
.combo-grid tbody td.c-sticky { background:#fff; }
.combo-grid tbody tr:nth-child(even) td.c-sticky { background:#fafbfc; }
.combo-grid tbody tr:hover td.c-sticky { background:#eef5f9; }
.muted-cell { color:#77838d; }


/* ==========================================================
   v0.4e – Kombiliste: flächige Gruppenpraxis-Markierung
   ========================================================== */

/* Praxis-Titelzeile: etwas kräftigere Grundtönung */
.combo-grid tbody tr.combo-practice-row td,
.combo-grid tbody tr.combo-practice-row td.c-sticky {
    background: var(--nfd-group-header-bg) !important;
}
.combo-practice-row td { border-top: 2px solid var(--border-strong); }
.combo-practice-row .practice-name { font-weight: 800; color: #244f6b; }
.combo-practice-row .practice-city { color: #657582; font-weight: 650; }

/* Zugehörige Arztzeilen: gleiche Grundtönung über die gesamte Breite */
.combo-grid tbody tr.combo-group-child td,
.combo-grid tbody tr.combo-group-child td.c-sticky {
    background: var(--nfd-group-bg) !important;
}
.combo-grid tbody tr.combo-group-child:hover td,
.combo-grid tbody tr.combo-group-child:hover td.c-sticky {
    background: var(--nfd-group-hover-bg) !important;
}

/* Dispensation innerhalb einer Gruppenpraxis:
   Petrol-Akzent wird transparent über die Gruppenfarbe gelegt. */
.combo-grid tbody tr.combo-group-child.is-dispensated td,
.combo-grid tbody tr.combo-group-child.is-dispensated td.c-sticky {
    background:
        linear-gradient(var(--nfd-dispensation-overlay), var(--nfd-dispensation-overlay)),
        var(--nfd-group-bg) !important;
}
.combo-grid tbody tr.combo-group-child.is-dispensated:hover td,
.combo-grid tbody tr.combo-group-child.is-dispensated:hover td.c-sticky {
    background:
        linear-gradient(var(--nfd-dispensation-overlay-hover), var(--nfd-dispensation-overlay-hover)),
        var(--nfd-group-hover-bg) !important;
}

/* Manuell angepasst innerhalb einer Gruppen-Arztzeile:
   Magenta-Akzent nur über der betroffenen DP-Zelle. */
.combo-grid tbody tr.combo-group-child td.manual-adjusted-cell {
    background:
        linear-gradient(var(--nfd-manual-overlay), var(--nfd-manual-overlay)),
        var(--nfd-group-bg) !important;
}

/* Manuell angepasster Praxis-Gesamtwert */
.combo-grid tbody tr.combo-practice-row td.manual-adjusted-cell {
    background:
        linear-gradient(var(--nfd-manual-overlay), var(--nfd-manual-overlay)),
        var(--nfd-group-header-bg) !important;
}

/* Kombination Dispensation + Manuell angepasst */
.combo-grid tbody tr.combo-group-child.is-dispensated td.manual-adjusted-cell {
    background:
        linear-gradient(var(--nfd-manual-overlay), var(--nfd-manual-overlay)),
        linear-gradient(var(--nfd-dispensation-overlay), var(--nfd-dispensation-overlay)),
        var(--nfd-group-bg) !important;
}



/* v0.62l – Kombiliste ohne Zebra; Praxisblöcke klar abgegrenzt. */
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) { background:#fff; }
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):nth-child(even) { background:#fff; }
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.c-sticky,
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):nth-child(even) td.c-sticky { background:#fff !important; }
.combo-grid tbody tr.combo-practice-row td:first-child,
.combo-grid tbody tr.combo-group-child td:first-child { border-left:3px solid var(--nfd-group-border); }
.combo-grid tbody tr.combo-practice-row td:last-child,
.combo-grid tbody tr.combo-group-child td:last-child { border-right:3px solid var(--nfd-group-border); }
.combo-grid tbody tr.combo-practice-row td { border-top:3px solid var(--nfd-group-border); }
.combo-grid tbody tr.combo-group-last td,
.combo-grid tbody tr.combo-group-single td { border-bottom:3px solid var(--nfd-group-border); }
.missing-soft { background:var(--nfd-missing-soft-bg) !important; box-shadow:inset 0 0 0 1px var(--nfd-missing-soft-border); }

/* ==========================================================
   v0.5 – Docbox-Liste
   ========================================================== */
.docbox-toolbar {
    flex-wrap: wrap;
}
.toolbar-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.toolbar-control select {
    height: 31px;
    padding: 0 26px 0 8px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.docbox-grid {
    min-width: 1030px;
}
.docbox-grid th:nth-child(1), .docbox-grid td:nth-child(1) {
    width: 58px;
    min-width: 58px;
}
.docbox-grid th:nth-child(2), .docbox-grid td:nth-child(2) {
    min-width: 180px;
}
.docbox-grid th:nth-child(3), .docbox-grid td:nth-child(3) {
    width: 58px;
    min-width: 58px;
}
.docbox-grid th:nth-child(4), .docbox-grid td:nth-child(4) {
    min-width: 210px;
}
.docbox-grid th:nth-child(5), .docbox-grid td:nth-child(5) {
    min-width: 150px;
}
.docbox-grid th:nth-child(6), .docbox-grid td:nth-child(6),
.docbox-grid th:nth-child(7), .docbox-grid td:nth-child(7) {
    min-width: 95px;
}
.docbox-grid th:nth-child(8), .docbox-grid td:nth-child(8) {
    min-width: 90px;
}
.docbox-login-cell {
    font-family: Consolas, "Courier New", monospace;
    font-size: 11.5px;
    color: #344b5b;
}
.warning-col,
.warning-cell {
    text-align: center !important;
}
.warning-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--nfd-cave-bg);
    border: 1px solid var(--nfd-cave-border);
    color: var(--nfd-cave-symbol);
    font-weight: 850;
    font-size: 13px;
    line-height: 1;
    cursor: help;
}


/* ==========================================================
   v0.6 – Dritte Zeitebene / Ärzteliste
   ========================================================== */
.doctor-grid {
    min-width: 2320px;
}

/* Fünf logisch getrennte Headergruppen */
.doctor-grid .group-person { background: var(--surface-header) !important; }
.doctor-grid .group-freeze { background: var(--nfd-freeze-header-bg) !important; }
.doctor-grid .group-current { background: var(--nfd-current-header-bg) !important; }
.doctor-grid .group-upcoming { background: var(--nfd-upcoming-header-bg) !important; }
.doctor-grid .group-comments { background: var(--nfd-comments-header-bg) !important; }

.doctor-grid .freeze-head { background: var(--nfd-freeze-header-bg) !important; }
.doctor-grid .current-head { background: var(--nfd-current-header-bg) !important; }
.doctor-grid .upcoming-head { background: var(--nfd-upcoming-header-bg) !important; }
.doctor-grid .comments-head { background: var(--nfd-comments-header-bg) !important; }

/* Grundflächen der drei Zeitebenen */
.doctor-grid tbody td.freeze-cell { background: var(--nfd-freeze-bg); }
.doctor-grid tbody td.current-cell { background: var(--nfd-current-bg); }
.doctor-grid tbody td.upcoming-cell { background: var(--nfd-upcoming-bg); }
.doctor-grid tbody td.comments-cell { background: var(--nfd-comments-bg); }

/* Dezente Hover-Verstärkung, ohne die Blocksemantik aufzuheben */
.doctor-grid tbody tr:hover td.freeze-cell { filter: brightness(.985); }
.doctor-grid tbody tr:hover td.current-cell { filter: brightness(.985); }
.doctor-grid tbody tr:hover td.upcoming-cell { filter: brightness(.985); }
.doctor-grid tbody tr:hover td.comments-cell { filter: brightness(.985); }

/* Dispensation gilt jeweils nur in der betreffenden Zeitebene.
   Freeze-Dispensation färbt nur den Freeze-Block (Spalten 8–13),
   kommende Dispensation nur den Planungsblock (Spalten 16–21).
   Die Petrolfarbe wird als transparente Ebene über die jeweilige
   Blockgrundfarbe gelegt. */
.doctor-grid tbody tr.freeze-dispensated-row td:nth-child(n+8):nth-child(-n+13) {
    background:
        linear-gradient(var(--nfd-dispensation-overlay), var(--nfd-dispensation-overlay)),
        var(--nfd-freeze-bg) !important;
}
.doctor-grid tbody tr.upcoming-dispensated-row td:nth-child(n+16):nth-child(-n+21) {
    background:
        linear-gradient(var(--nfd-dispensation-overlay), var(--nfd-dispensation-overlay)),
        var(--nfd-upcoming-bg) !important;
}

/* Manuelle Anpassung als Overlay über der jeweiligen Zeitblockfarbe */
.doctor-grid tbody td.freeze-cell.manual-adjusted-cell {
    background:
        linear-gradient(var(--nfd-manual-overlay), var(--nfd-manual-overlay)),
        var(--nfd-freeze-bg) !important;
}
.doctor-grid tbody td.upcoming-cell.manual-adjusted-cell {
    background:
        linear-gradient(var(--nfd-manual-overlay), var(--nfd-manual-overlay)),
        var(--nfd-upcoming-bg) !important;
}

/* Kompakte, aber lesbare Spezialspalten */
.doctor-grid .replacement-fee-col { min-width: 112px; }
.doctor-grid .replacement-fee-cell { font-variant-numeric: tabular-nums; }
.doctor-grid .ap-mutation-col { min-width: 125px; }
.doctor-grid .ap-mutation-cell { color: #4e6474; font-weight: 600; }

/* Legende unterhalb der Tabelle */
.table-legend-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    margin: -5px 18px 18px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.45;
}
.table-legend-footer strong {
    color: #4b5b68;
    font-weight: 700;
}


/* ==========================================================
   v0.6a – X-Achsen-Feinschliff Ärzteliste
   ========================================================== */

/* Region: nur moderat enger als bisher. */
.doctor-grid th.region-col,
.doctor-grid td.sticky-col-1 {
    padding-left: 6px;
    padding-right: 6px;
    min-width: 42px;
}

/* Praxis: Standardbreite ca. 40 % kleiner; Inhalt mit Ellipse.
   Später kann dieselbe width/min/max-Logik durch User-Spaltenbreiten
   überschrieben werden. */
.doctor-grid th.practice-col,
.doctor-grid td.practice-cell {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
}
.doctor-grid td.practice-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Prozentfelder brauchen kaum horizontale Reserve. */
.doctor-grid th.compact-percent-col,
.doctor-grid th.dp-nfp-col,
.doctor-grid th.ap-today-col {
    min-width: 64px;
    padding-left: 5px;
    padding-right: 5px;
}
.doctor-grid th.dp-nfp-col {
    min-width: 70px;
}

/* Ersatzabgabe: CHF 3'000.00 passt bequem, ohne die bisherige Leerspalte. */
.doctor-grid th.replacement-fee-col,
.doctor-grid td.replacement-fee-cell {
    min-width: 86px;
    width: 86px;
    padding-left: 5px;
    padding-right: 7px;
}

/* AP-Mutationen etwa 25 % kompakter. */
.doctor-grid th.ap-mutation-col,
.doctor-grid td.ap-mutation-cell {
    min-width: 94px;
    width: 94px;
    max-width: 94px;
    padding-left: 6px;
    padding-right: 6px;
}
.doctor-grid td.ap-mutation-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Die Tabelle darf nun von den tatsächlich benötigten Spaltenbreiten
   bestimmt werden; kein künstliches 2320-px-Minimum mehr. */
.doctor-grid {
    min-width: 0;
}


/* ==========================================================
   v0.6b – Dritte Zeitebene / Kombiliste
   Gleiche Spaltenlogik wie Ärzteliste; Gruppenpraxisfarbe bleibt
   die Basis und wird mit den Zeitebenen nur sehr dezent überlagert.
   ========================================================== */
.combo-grid.group {} /* namespace marker */

.combo-grid .group-person { background: var(--surface-header) !important; }
.combo-grid .group-freeze { background: var(--nfd-freeze-header-bg) !important; }
.combo-grid .group-current { background: var(--nfd-current-header-bg) !important; }
.combo-grid .group-upcoming { background: var(--nfd-upcoming-header-bg) !important; }
.combo-grid .group-comments { background: var(--nfd-comments-header-bg) !important; }
.combo-grid .freeze-head { background: var(--nfd-freeze-header-bg) !important; }
.combo-grid .current-head { background: var(--nfd-current-header-bg) !important; }
.combo-grid .upcoming-head { background: var(--nfd-upcoming-header-bg) !important; }
.combo-grid .comments-head { background: var(--nfd-comments-header-bg) !important; }

.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.freeze-cell { background: var(--nfd-freeze-bg); }
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.current-cell { background: var(--nfd-current-bg); }
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.upcoming-cell { background: var(--nfd-upcoming-bg); }
.combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.comments-cell { background: var(--nfd-comments-bg); }

/* Gruppenblock: bestehende Blau/Violett-Tönung bleibt sichtbar;
   Zeitblockfarbe wird transparent darübergelegt. */
.combo-grid tbody tr.combo-practice-row td.freeze-cell,
.combo-grid tbody tr.combo-group-child td.freeze-cell {
    background: linear-gradient(rgba(244,246,247,.42),rgba(244,246,247,.42)), var(--nfd-group-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.current-cell,
.combo-grid tbody tr.combo-group-child td.current-cell {
    background: linear-gradient(rgba(250,251,252,.30),rgba(250,251,252,.30)), var(--nfd-group-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.upcoming-cell,
.combo-grid tbody tr.combo-group-child td.upcoming-cell {
    background: linear-gradient(rgba(255,246,241,.38),rgba(255,246,241,.38)), var(--nfd-group-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.comments-cell,
.combo-grid tbody tr.combo-group-child td.comments-cell {
    background: linear-gradient(rgba(251,250,247,.26),rgba(251,250,247,.26)), var(--nfd-group-bg) !important;
}

/* Semantische Overlays haben Vorrang. */
.combo-grid tbody tr.freeze-dispensated-row td:nth-child(n+8):nth-child(-n+13) {
    background: linear-gradient(var(--nfd-dispensation-overlay),var(--nfd-dispensation-overlay)),var(--nfd-freeze-bg) !important;
}
.combo-grid tbody tr.upcoming-dispensated-row td:nth-child(n+16):nth-child(-n+21) {
    background: linear-gradient(var(--nfd-dispensation-overlay),var(--nfd-dispensation-overlay)),var(--nfd-upcoming-bg) !important;
}
.combo-grid tbody td.freeze-cell.manual-adjusted-cell {
    background: linear-gradient(var(--nfd-manual-overlay),var(--nfd-manual-overlay)),var(--nfd-freeze-bg) !important;
}
.combo-grid tbody td.upcoming-cell.manual-adjusted-cell {
    background: linear-gradient(var(--nfd-manual-overlay),var(--nfd-manual-overlay)),var(--nfd-upcoming-bg) !important;
}

/* Gleicher X-Achsen-Feinschliff wie Ärzteliste. */
.combo-grid th.region-col,.combo-grid td.c-sticky-1 {padding-left:6px;padding-right:6px;min-width:42px;}
.combo-grid th.practice-col,.combo-grid td.practice-cell {width:108px;min-width:108px;max-width:108px;}
.combo-grid td.practice-cell {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.combo-grid th.compact-percent-col,.combo-grid th.dp-nfp-col,.combo-grid th.ap-today-col {min-width:64px;padding-left:5px;padding-right:5px;}
.combo-grid th.dp-nfp-col {min-width:70px;}
.combo-grid th.replacement-fee-col,.combo-grid td.replacement-fee-cell {min-width:86px;width:86px;padding-left:5px;padding-right:7px;}
.combo-grid th.ap-mutation-col,.combo-grid td.ap-mutation-cell {min-width:94px;width:94px;max-width:94px;padding-left:6px;padding-right:6px;}
.combo-grid td.ap-mutation-cell {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}


/* ==========================================================
   v0.6c – Gruppenpraxis-Kopfzeile + Docbox-Header
   ========================================================== */

/* Die Gruppenpraxis-Kopfzeile behält in jedem Zeitblock ihre stärkere
   Gruppenfarbe. Die Zeitblockfarbe wird nur transparent darübergelegt. */
.combo-grid tbody tr.combo-practice-row td.freeze-cell {
    background:
        linear-gradient(rgba(244,246,247,.32),rgba(244,246,247,.32)),
        var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.current-cell {
    background:
        linear-gradient(rgba(250,251,252,.22),rgba(250,251,252,.22)),
        var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.upcoming-cell {
    background:
        linear-gradient(rgba(255,246,241,.28),rgba(255,246,241,.28)),
        var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.comments-cell {
    background:
        linear-gradient(rgba(251,250,247,.18),rgba(251,250,247,.18)),
        var(--nfd-group-header-bg) !important;
}

/* Auch leere/inaktive Zellen der Praxis-Kopfzeile sollen den Block nicht
   optisch durchschneiden. */
.combo-grid tbody tr.combo-practice-row td.inactive-cell {
    background: var(--nfd-group-header-bg) !important;
}


/* ==========================================================
   v0.6d – Docbox: kein Gruppenheader, daher kein 24px-Sticky-Offset
   ========================================================== */
.docbox-grid thead th {
    top: 0 !important;
}

/* ==========================================================
   v0.7 – User-Interaktionen: AP heute / AP Mutationen
   ========================================================== */
.data-grid td.interactive-cell {
    cursor: pointer;
    transition: box-shadow .12s ease, filter .12s ease;
}
.data-grid td.interactive-cell:hover {
    box-shadow: inset 0 0 0 1px rgba(53,91,109,.24);
    filter: brightness(.985);
}

.nfd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(22,31,36,.34);
    backdrop-filter: blur(1.5px);
}
.nfd-modal {
    width: min(520px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid rgba(45,64,72,.18);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(17,27,32,.22);
}
.nfd-modal-wide { width: min(720px, calc(100vw - 32px)); }
.nfd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(45,64,72,.13);
    background: #f7f9fa;
}
.nfd-modal-header h2 { margin: 0; font-size: 16px; font-weight: 650; }
.nfd-modal-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #58676d;
    cursor: pointer;
}
.nfd-modal-body { max-height: calc(100vh - 120px); overflow: auto; padding: 16px; }
.nfd-dialog-context {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: baseline;
    padding: 9px 11px;
    border-radius: 7px;
    background: #f4f7f8;
    font-size: 13px;
}
.nfd-dialog-context span { color: #637178; white-space: nowrap; }
.nfd-dialog-subtitle { margin: 16px 0 7px; font-size: 13px; font-weight: 650; color: #38484f; }
.nfd-help-text { margin: 11px 0 7px; font-size: 12px; color: #68767c; }
.nfd-empty-state { padding: 9px 10px; border: 1px dashed #ccd5d9; border-radius: 6px; color: #7a878c; font-size: 12px; }
.nfd-mutation-list-wrap { max-height: 210px; overflow: auto; border: 1px solid #d8dfe2; border-radius: 6px; }
.nfd-mutation-list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.nfd-mutation-list th { text-align: left; padding: 6px 9px; background: #f5f7f8; border-bottom: 1px solid #d8dfe2; color: #56666d; font-weight: 600; }
.nfd-mutation-list td { padding: 7px 9px; border-bottom: 1px solid #edf0f1; }
.nfd-mutation-list tr:last-child td { border-bottom: 0; }
.nfd-mutation-list tr.js-mutation-row { cursor: pointer; }
.nfd-mutation-list tr.js-mutation-row:hover td { background: #f5f9fa; }
.nfd-mutation-list tr.js-mutation-row.selected td { background: #edf5f7; }
.nfd-mutation-delete-cell { width: 34px; text-align: center; }
.nfd-icon-delete { border: 0; background: transparent; color: #8b5555; cursor: pointer; font-size: 18px; line-height: 1; padding: 1px 4px; }
.nfd-form { margin-top: 5px; }
.nfd-form-grid {
    display: grid;
    grid-template-columns: minmax(120px,.7fr) minmax(150px,1fr) minmax(190px,1.2fr);
    gap: 10px;
    align-items: end;
}
.nfd-form label { display: grid; gap: 5px; font-size: 12px; color: #596970; }
.nfd-form input,.nfd-form select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #bcc8cd;
    border-radius: 5px;
    background: #fff;
    color: #24343b;
    padding: 7px 8px;
    font: inherit;
    outline: none;
}
.nfd-form input:focus,.nfd-form select:focus { border-color: #668b9a; box-shadow: 0 0 0 2px rgba(80,126,145,.12); }
.nfd-input-suffix { display: flex; align-items: center; }
.nfd-input-suffix input { border-radius: 5px 0 0 5px; }
.nfd-input-suffix b { padding: 7px 8px; border: 1px solid #bcc8cd; border-left: 0; border-radius: 0 5px 5px 0; background: #f2f5f6; font-weight: 500; color: #67767c; }
.nfd-form-error { margin-top: 10px; padding: 7px 9px; border-radius: 5px; background: #fff2f2; color: #9a3f3f; font-size: 12px; }
.nfd-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.nfd-modal-actions button { padding: 7px 12px; border-radius: 5px; font: inherit; cursor: pointer; }
.nfd-modal-actions button:disabled { opacity: .55; cursor: default; }
.btn-secondary { border: 1px solid #c4ced2; background: #fff; color: #47585f; }
.btn-primary { border: 1px solid #466f80; background: #557f90; color: #fff; }
@media (max-width: 700px) {
    .nfd-form-grid { grid-template-columns: 1fr; }
    .nfd-dialog-context { align-items: flex-start; flex-direction: column; gap: 3px; }
}

/* v0.7a – vorgemerkte Löschungen im AP-Mutationsdialog */
.nfd-pending-delete-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border, #d9dee5);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}
.nfd-pending-delete-actions[hidden] { display: none !important; }

/* ==========================================================
   v0.7b – AP-Historie im Mutationsdialog
   ========================================================== */
.nfd-history-list-wrap { max-height: 270px; }
.nfd-history-status {
    display: inline-block;
    min-width: 58px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    background: #eef1f2;
    color: #66757b;
}
.nfd-history-aktuell { background: #e7f1ee; color: #315f54; font-weight: 600; }
.nfd-history-zukünftig { background: #eef3f7; color: #486677; }
.nfd-delete-protected { color: #bcc4c7; cursor: not-allowed; font-size: 17px; line-height: 1; }

/* ==========================================================
   v0.8 – Kommende Planung: regionales DP / Override
   ========================================================== */
.nfd-dialog-context-stack {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
}
.nfd-info-note {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #e4d7a9;
    border-radius: 6px;
    background: #fffaf0;
    color: #725f2d;
    font-size: 12px;
    line-height: 1.4;
}
.nfd-choice-list {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}
.nfd-choice-card {
    display: grid !important;
    grid-template-columns: 22px minmax(0,1fr);
    gap: 9px !important;
    align-items: start;
    padding: 10px 11px;
    border: 1px solid #d3dbde;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    color: #314148 !important;
}
.nfd-choice-card.is-active {
    border-color: #89a6b1;
    background: #f7fafb;
}
.nfd-choice-card > input[type="radio"] {
    width: auto;
    margin: 3px 0 0;
}
.nfd-choice-content {
    display: grid;
    gap: 7px;
}
.nfd-choice-content > b { font-size: 13px; font-weight: 650; }
.nfd-choice-content textarea {
    width: 100%;
    min-height: 52px;
    resize: vertical;
    box-sizing: border-box;
    border: 1px solid #bcc8cd;
    border-radius: 5px;
    background: #fff;
    color: #24343b;
    padding: 7px 8px;
    font: inherit;
    outline: none;
}
.nfd-choice-content textarea:focus {
    border-color: #668b9a;
    box-shadow: 0 0 0 2px rgba(80,126,145,.12);
}
.nfd-choice-content input:disabled,
.nfd-choice-content textarea:disabled {
    background: #f2f4f5;
    color: #919ca0;
    cursor: default;
}
.nfd-field-label {
    margin-bottom: -3px;
    font-size: 11.5px;
    color: #596970;
}
.nfd-field-label em {
    margin-left: 4px;
    color: #8b5656;
    font-style: normal;
}
.nfd-readonly-percent input { background: #f4f6f7; color: #4f5e64; }

/* ==========================================================
   v0.9 – Kommende Planung: Dispensation + Ersatzabgabe
   ========================================================== */
.nfd-dispensation-grid { margin-top: 14px; }
.nfd-dispensation-grid .nfd-field-wide { grid-column: 1 / -1; }
.nfd-dispensation-grid textarea {
    width: 100%; min-height: 52px; resize: vertical; box-sizing: border-box;
    border: 1px solid #bcc8cd; border-radius: 5px; padding: 7px 8px; font: inherit;
}
.nfd-duration-preview { align-self: end; padding: 8px 10px; border-radius: 5px; background: #f4f6f7; color: #58686f; font-size: 12px; }
.nfd-fee-box { margin-top: 14px; padding: 10px 11px; border: 1px solid #d8dfe2; border-radius: 7px; background: #fafbfb; }
.nfd-check-line { display: flex !important; align-items: center; gap: 7px !important; margin-bottom: 9px; cursor: pointer; }
.nfd-check-line input { width: auto !important; margin: 0; }
.nfd-fee-box .nfd-field { max-width: 260px; }
.nfd-fee-box .nfd-field.is-disabled { opacity: .55; }
.nfd-fee-hint { margin-top: 8px; }
.nfd-modal-actions-split { justify-content: space-between; gap: 16px; }
.nfd-action-group { display: flex; gap: 8px; }
.btn-danger-soft { border: 1px solid #d7b7b7; background: #fff8f8; color: #8b4b4b; border-radius: 5px; padding: 7px 10px; cursor: pointer; }
.btn-danger-soft:hover { background: #fbeeee; }

/* ==========================================================
   v1.0 – NFP / DP NFP + kleiner v0.9-Breitenfix
   ========================================================== */
.nfd-dispensation-grid select[name="duration"] { min-width: 168px; }
.js-nfp-toggle.is-saving { opacity: .55; pointer-events: none; }
.js-nfp-percentage.is-inline-editing { padding-top: 2px !important; padding-bottom: 2px !important; }
.nfd-inline-percent {
    display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px;
    width: 100%; min-width: 64px;
}
.nfd-inline-percent input {
    width: 52px; min-width: 0; box-sizing: border-box;
    border: 1px solid #8faab3; border-radius: 4px; padding: 3px 5px;
    font: inherit; text-align: right; background: #fff;
}
.nfd-inline-percent input:focus { outline: 2px solid rgba(72,126,143,.18); outline-offset: 0; }
.nfd-inline-percent > span { color: #5a676c; }

/* ==========================================================
   v1.1 – Cave + Bemerkungseditor + Dispensations-Breitenfix
   ========================================================== */
/* Der Dispensationsdialog hat in dieser Zeile bewusst nur zwei Spalten. */
.nfd-dispensation-grid {
    grid-template-columns: minmax(190px,.8fr) minmax(220px,1.2fr);
}
.nfd-dispensation-grid select[name="duration"] { min-width: 0; }

.nfd-cave-field {
    display: grid;
    gap: 5px;
    margin-top: 14px;
    font-size: 12px;
    color: #596970;
}
.nfd-cave-field textarea {
    width: 100%;
    min-height: 86px;
    resize: vertical;
    box-sizing: border-box;
    border: 1px solid #bcc8cd;
    border-radius: 5px;
    background: #fff;
    color: #24343b;
    padding: 8px 9px;
    font: inherit;
    line-height: 1.4;
    outline: none;
}
.nfd-cave-field textarea:focus {
    border-color: #668b9a;
    box-shadow: 0 0 0 2px rgba(80,126,145,.12);
}

/* Standardansicht bleibt strikt einzeilig und damit tabellarisch schlank. */
.nfd-note-display {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 1.2em;
}
.notes-cell.is-note-editing {
    position: relative;
    z-index: 6;
    background: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(70,111,128,.38), 0 3px 12px rgba(25,43,51,.12);
}
.notes-cell.is-note-editing .nfd-note-display {
    min-height: 52px;
    max-height: 180px;
    overflow: auto;
    text-overflow: clip;
    white-space: normal;
    padding: 5px 6px;
    margin: -5px -6px;
    color: #2f3f46;
    cursor: text;
    outline: none;
    line-height: 1.35;
}
.notes-cell.is-note-saving { opacity: .72; }
.nfd-note-toolbar {
    position: fixed;
    z-index: 2400;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid #bcc8cd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(24,39,46,.18);
}
.nfd-note-toolbar button {
    min-width: 29px;
    height: 27px;
    padding: 2px 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #3e4e55;
    font: inherit;
    cursor: pointer;
}
.nfd-note-toolbar button:hover { background: #edf3f5; }

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

/* ==========================================================
   v0.13 – Mitgliederverwaltung V1
   ========================================================== */
.members-main{min-width:0;overflow:auto;background:#f4f6f7}.members-topbar{min-height:78px}.members-eval-badge{align-self:center;padding:5px 9px;border:1px solid #d4dde1;border-radius:999px;background:#f8fafb;color:#63747b;font-size:11px;font-weight:700;letter-spacing:.03em}.members-toolbar{display:flex;align-items:flex-end;gap:14px;padding:14px 20px;border-bottom:1px solid #dbe2e5;background:#fff}.member-picker{width:min(520px,56vw)}.member-picker>label,.member-form-grid label,.status-box label{display:grid;gap:5px;font-size:11px;font-weight:700;color:#617178}.member-combo{position:relative;display:flex}.member-combo>input{width:100%;height:36px;border:1px solid #bfcbd0;border-radius:6px 0 0 6px;padding:0 10px;font:inherit;color:#26383f;outline:none}.member-combo>button{width:38px;border:1px solid #bfcbd0;border-left:0;border-radius:0 6px 6px 0;background:#f6f8f9;color:#52656d;cursor:pointer}.member-combo>input:focus{border-color:#668b9a;box-shadow:0 0 0 2px rgba(80,126,145,.10)}.member-picker-menu{position:absolute;z-index:1000;top:100%;left:0;right:0;max-height:310px;overflow:auto;margin-top:3px;border:1px solid #c7d2d6;border-radius:6px;background:#fff;box-shadow:0 10px 26px rgba(31,48,56,.16)}.member-picker-menu button[hidden]{display:none!important}.member-picker-menu button{display:flex;justify-content:space-between;gap:12px;width:100%;padding:8px 10px;border:0;border-bottom:1px solid #eef1f2;background:#fff;text-align:left;font:inherit;color:#31434a;cursor:pointer}.member-picker-menu button:hover{background:#edf4f6}.member-picker-menu small{color:#a06464}.members-new-btn{height:36px;white-space:nowrap}.members-layout{display:grid;gap:12px;padding:16px 20px 20px;max-width:1450px}.member-card{border:1px solid #d7e0e3;border-radius:8px;background:#fff;box-shadow:0 1px 2px rgba(24,39,46,.04)}.member-card-head{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:11px 14px;border-bottom:1px solid #e5eaec}.member-card h2{margin:0;font-size:14px;color:#30444c}.member-card p{margin:3px 0 0;font-size:11px;color:#78868c}.member-form-grid{display:grid;gap:11px;padding:13px 14px}.member-form-grid.cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.member-form-grid .span-2{grid-column:span 2}.member-form-grid .span-4{grid-column:span 4}.member-form-grid input,.member-form-grid select,.status-box input,.wide-select,.specialty-add select,.member-table input,.member-table select{box-sizing:border-box;width:100%;height:33px;border:1px solid #c4cfd3;border-radius:5px;background:#fff;padding:0 8px;font:inherit;color:#2f4047;outline:none}.member-form-grid input:focus,.member-form-grid select:focus,.status-box input:focus,.wide-select:focus,.specialty-add select:focus,.member-table input:focus,.member-table select:focus{border-color:#668b9a;box-shadow:0 0 0 2px rgba(80,126,145,.10)}.members-save,.secondary-btn{height:31px;padding:0 11px;border:1px solid #bdc9ce;border-radius:5px;background:#f8fafb;color:#43565e;font:inherit;font-size:11px;font-weight:700;cursor:pointer}.members-save:hover,.secondary-btn:hover{background:#eef3f5}.status-specialty-layout{display:grid;grid-template-columns:250px minmax(0,1fr);gap:18px;padding:13px 14px}.field-caption{margin-bottom:7px;font-size:11px;font-weight:700;color:#617178}.status-box{display:grid;align-content:start;gap:12px}.segmented{display:grid;grid-template-columns:1fr 1fr;width:140px}.segmented button{height:31px;border:1px solid #bdc9ce;background:#fff;color:#586a72;font:inherit;font-weight:700;cursor:pointer}.segmented button:first-child{border-radius:5px 0 0 5px}.segmented button:last-child{border-left:0;border-radius:0 5px 5px 0}.segmented button.active{background:#dcecef;color:#245366;border-color:#83a8b6}.specialty-list{display:grid;gap:5px}.specialty-row{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:30px;padding:4px 8px;border:1px solid #e0e6e8;border-radius:5px;background:#fafbfb;font-size:11px}.specialty-row button,.icon-action{border:0;background:transparent;color:#6c7c82;font-size:17px;cursor:pointer}.specialty-add{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;margin-top:8px}.specialty-add button{border:1px solid #bdc9ce;border-radius:5px;background:#f7f9fa;padding:0 10px;color:#44585f;font:inherit;cursor:pointer}.member-inline-row{display:flex;gap:8px;padding:13px 14px}.wide-select{max-width:520px}.member-table-wrap{overflow:auto}.member-table{width:100%;border-collapse:collapse;font-size:11px}.member-table th{padding:7px 8px;border-bottom:1px solid #dce4e7;background:#f5f7f8;color:#62747b;text-align:left;font-weight:700;white-space:nowrap}.member-table td{padding:6px 8px;border-bottom:1px solid #edf0f1;vertical-align:middle}.member-table tbody tr:last-child td{border-bottom:0}.member-table .numeric{text-align:right}.member-table td:first-child{min-width:220px}.member-table td:first-child small{display:block;margin-top:2px;color:#859298}.practice-link{padding:0;border:0;background:none;color:#315f72;font:inherit;font-weight:700;cursor:pointer}.practice-link:hover{text-decoration:underline}.region-pill{display:inline-flex;min-width:25px;justify-content:center;padding:2px 5px;border:1px solid #c7d5da;border-radius:999px;background:#edf4f6;color:#40626f;font-weight:700}.percent-input{display:flex;align-items:center;justify-content:flex-end;gap:4px}.percent-input input{width:72px;text-align:right}.percent-input span{color:#65757b}.muted-row{padding:9px;color:#8b979c;font-size:11px}.member-danger-card{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:12px 14px}.members-footnote{padding:0 20px 18px;color:#869399;font-size:10px}.members-empty{margin:20px;padding:20px;border:1px dashed #cbd5d9;border-radius:7px;background:#fff;color:#7b898f}.practice-modal{width:min(780px,calc(100vw - 40px));}.practice-subsection{padding:12px 14px;border-top:1px solid #e8ecee}.practice-subsection h3{margin:0 0 7px;font-size:12px;color:#52656d}.practice-subsection .member-inline-row{padding:0}.practice-subsection textarea{box-sizing:border-box;width:100%;border:1px solid #c4cfd3;border-radius:5px;padding:7px 8px;font:inherit;line-height:1.4;resize:vertical;color:#2f4047}.readonly-hint{font-weight:400;color:#8a989d}.locality-note{align-self:end;padding:5px 0;color:#839198;font-size:10px;line-height:1.35}
@media(max-width:900px){.member-form-grid.cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}.member-form-grid .span-4{grid-column:span 2}.status-specialty-layout{grid-template-columns:1fr}.members-toolbar{align-items:stretch;flex-direction:column}.member-picker{width:100%}}

/* ==========================================================
   v0.13a – Mitgliederverwaltung Feinschliff
   ========================================================== */
/* Nur die beiden oberen Stammdatenblöcke diskret kompakter. */
.members-layout>.member-card:nth-of-type(1) .member-card-head,
.members-layout>.member-card:nth-of-type(2) .member-card-head{padding-top:9px;padding-bottom:9px}
.members-layout>.member-card:nth-of-type(1) .member-form-grid{padding-top:10px;padding-bottom:10px;gap:9px}
.members-layout>.member-card:nth-of-type(2) .status-specialty-layout{padding-top:10px;padding-bottom:10px;gap:16px}
.status-date-help{display:block;margin-top:1px;color:#8a989d;font-size:10px;font-weight:400;line-height:1.25}
.status-box input:disabled{background:#f1f3f4;color:#929da1;cursor:not-allowed}
.practice-name-line{display:flex;align-items:center;gap:4px;min-width:0}
.practice-name{color:#31454d;font-weight:700}
.practice-name-line .icon-action{flex:0 0 auto;padding:0 2px;font-size:15px;line-height:1;color:#708087}
.practice-name-line .icon-action:hover{color:#315f72;background:#edf4f6;border-radius:3px}
/* v0.14 Mitgliederverwaltung: Stammdaten-Interaktionen */
.member-editor-fieldset{border:0;padding:0;margin:0;min-width:0;display:contents}
.member-editor-fieldset:disabled .member-card{opacity:.56}
.member-note-editor{min-height:58px;border:1px solid var(--border,#cbd5df);border-radius:5px;background:#fff;padding:8px 10px;font:inherit;line-height:1.35;outline:none}
.member-note-editor:focus{border-color:#7d9bb8;box-shadow:0 0 0 2px rgba(70,110,150,.10)}
.members-layout .member-card:nth-of-type(1),.members-layout .member-card:nth-of-type(2){padding-top:14px;padding-bottom:14px}
.members-layout .member-card:nth-of-type(1) .member-card-head,.members-layout .member-card:nth-of-type(2) .member-card-head{margin-bottom:10px}

/* Mitgliederverwaltung v0.14c: ruhige Inline-Plausibilisierung */
.members-save-wrap{display:flex;align-items:center;gap:10px}.member-validation-summary{font-size:10px;font-weight:600;color:#7b898f;white-space:nowrap}.member-validation-summary.has-warnings{color:#9a7135}.member-validation-summary.has-errors{color:#a04444}
.member-form-grid input.field-soft-warning,.status-box input.field-soft-warning{border-color:#d9a66d;background:#fffaf3;box-shadow:inset 3px 0 0 #d9a66d}.member-form-grid input.field-hard-error,.status-box input.field-hard-error{border-color:#c86a6a;background:#fff5f5;box-shadow:inset 3px 0 0 #c86a6a}.member-form-grid input.field-hard-error:focus,.status-box input.field-hard-error:focus{border-color:#b85353;box-shadow:0 0 0 2px rgba(184,83,83,.10),inset 3px 0 0 #c86a6a}
.specialty-box.is-disabled{opacity:.55}.specialty-box.is-disabled .specialty-row,.specialty-box.is-disabled .specialty-add{pointer-events:none}.specialty-box.is-disabled .specialty-add select,.specialty-box.is-disabled .specialty-add button,.specialty-box.is-disabled .specialty-row button{cursor:not-allowed}
/* Mitgliederverwaltung v0.15 – Arbeitsorte */
.cell-edit{border:0;background:transparent;padding:2px 4px;margin:-2px -4px;font:inherit;color:inherit;cursor:pointer;border-radius:4px;text-align:left}.cell-edit:hover{background:rgba(15,92,110,.08);box-shadow:inset 0 0 0 1px rgba(15,92,110,.16)}
.workplace-modal{width:min(920px,calc(100vw - 32px))}.workplace-practice-choice{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(260px,.75fr);gap:22px;align-items:end;padding-bottom:18px;border-bottom:1px solid var(--line,#dbe3e8)}.workplace-practice-choice label,.workplace-new-practice .field-caption{display:block;font-weight:600;margin-bottom:6px}.workplace-practice-choice input{width:100%}.workplace-new-practice{padding-bottom:1px}.workplace-new-practice button{width:100%}.workplace-modal .practice-subsection{margin-top:18px}.workplace-modal .percent-input input{width:100%}
@media(max-width:800px){.workplace-practice-choice{grid-template-columns:1fr}}
/* Mitgliederverwaltung v0.15a – Block 4a: zentrierte Arbeitsort-/Praxisdialoge + Ortszuordnung */
.nfd-modal-backdrop[hidden]{display:none!important}
.nfd-modal-backdrop{position:fixed;inset:0;z-index:2100;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(22,31,36,.34);backdrop-filter:blur(1.5px);box-sizing:border-box}
.nfd-modal-backdrop>.workplace-modal,.nfd-modal-backdrop>.practice-modal{display:flex;flex-direction:column;max-height:calc(100vh - 48px);margin:0;overflow:hidden}
.nfd-modal-backdrop>.workplace-modal>.nfd-modal-body,.nfd-modal-backdrop>.practice-modal>.nfd-modal-body{min-height:0;overflow:auto;max-height:none;flex:1 1 auto}
.nfd-modal-footer{display:flex;justify-content:flex-end;gap:8px;flex:0 0 auto;padding:11px 16px;border-top:1px solid rgba(45,64,72,.13);background:#f8fafb}
#prRegion:disabled{background:#f1f4f5;color:#40545c;opacity:1;cursor:default}
#prLocalityStatus.locality-matched{color:#46705b;font-weight:600}
#prLocalityStatus.locality-unmatched{color:#9a7135}
@media(max-height:640px){.nfd-modal-backdrop{align-items:flex-start;padding-top:16px;padding-bottom:16px}.nfd-modal-backdrop>.workplace-modal,.nfd-modal-backdrop>.practice-modal{max-height:calc(100vh - 32px)}}
/* v0.16 – Docbox planning */
.nfd-docbox-plan{margin-top:16px;padding:14px;border:1px solid var(--line,#d8dde3);border-radius:8px;background:rgba(255,255,255,.55)}
.nfd-docbox-plan select{width:100%;margin-top:6px}
.nfd-warning-note{margin-top:8px;padding:8px 10px;border-radius:6px;background:#fff4d6;color:#725000;font-size:.9rem}
.nfd-check-row{display:flex;align-items:center;gap:9px;padding:10px 0;font-weight:600}
.warning-badge.js-docbox-deactivate{cursor:pointer;box-shadow:0 0 0 2px rgba(180,80,20,.12)}
.member-inline-warning{margin-top:8px;padding:7px 9px;border:1px solid rgba(180,120,0,.28);border-radius:6px;background:rgba(245,190,45,.10);font-size:12px;line-height:1.35;color:#705300}

/* v0.16l – Direktnavigation, kompakte Listen, NFP-Dialog */
.entity-edit-link{display:inline-block;color:inherit;text-decoration:none;cursor:pointer;padding:2px 4px;margin:-2px -4px;border-radius:4px}
.entity-edit-link:hover{background:rgba(15,92,110,.08);box-shadow:inset 0 0 0 1px rgba(15,92,110,.16);text-decoration:none}
.compact-list-card{width:max-content;max-width:100%;min-width:min(100%,980px)}
.compact-list-card .table-scroll{max-width:100%;overflow:auto}
.practice-card table{width:auto;min-width:980px}
.docbox-card table{width:auto;min-width:980px}
.nfd-check-row-inline{display:flex!important;align-items:center!important;justify-content:flex-start!important;gap:7px!important}
.nfd-check-row-inline input{flex:0 0 auto!important;width:auto!important;height:auto!important;margin:0!important;padding:0!important;box-shadow:none!important}
.nfd-check-row-inline span{display:inline}

/* v0.16m – Feinschliff: Praxisdialog über Ursprungsliste + NFP-Checkbox */
.nfd-external-dialog-backdrop{position:fixed;inset:0;z-index:2600;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(22,31,36,.34);backdrop-filter:blur(1.5px);box-sizing:border-box}
.nfd-external-dialog-shell{width:min(820px,calc(100vw - 48px));height:min(760px,calc(100vh - 48px));border-radius:10px;overflow:hidden;box-shadow:0 18px 52px rgba(16,28,34,.28);background:transparent}
.nfd-external-dialog-shell iframe{display:block;width:100%;height:100%;border:0;background:transparent}
.practice-dialog-only{margin:0;background:transparent;overflow:hidden}
.practice-dialog-only>.app-shell,.practice-dialog-only>.members-footnote,.practice-dialog-only>#workplaceModal{display:none!important}
.practice-dialog-only>#practiceModal{position:static;display:flex!important;align-items:stretch;justify-content:stretch;inset:auto;padding:0;background:transparent;backdrop-filter:none;height:100vh}
.practice-dialog-only>#practiceModal[hidden]{display:flex!important}
.practice-dialog-only>#practiceModal>.practice-modal{width:100%;height:100%;max-height:100vh;border-radius:0;box-shadow:none}
.practice-dialog-only>#practiceModal>.practice-modal>.nfd-modal-body{max-height:none}
@media(max-width:700px){.nfd-external-dialog-backdrop{padding:8px}.nfd-external-dialog-shell{width:calc(100vw - 16px);height:calc(100vh - 16px)}}

/* v0.17 – einheitliche Interaktionssprache: ganze Tabellenzelle */
.entity-edit-link{display:block;color:inherit;text-decoration:none;cursor:pointer;padding:0;margin:0;border-radius:0}
.entity-edit-link:hover{background:transparent;box-shadow:none;text-decoration:none}
td.interactive-cell:has(> .entity-edit-link),td.interactive-cell:has(.entity-edit-link){cursor:pointer}
.compact-modal{width:min(650px,calc(100vw - 40px));display:flex;flex-direction:column;max-height:calc(100vh - 48px);overflow:hidden}
.compact-modal>.nfd-modal-body{overflow:auto}
.member-form-grid.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:650px){.member-form-grid.cols-2{grid-template-columns:1fr}.member-form-grid.cols-2 .span-2{grid-column:span 1}}
/* v0.18 – definitiver Planungs-Freeze */
.nfd-freeze-backdrop{position:fixed;inset:0;background:rgba(10,18,28,.52);display:flex;align-items:center;justify-content:center;z-index:3000;padding:24px}.nfd-freeze-dialog{width:min(720px,94vw);max-height:88vh;background:#fff;border-radius:12px;box-shadow:0 24px 70px rgba(0,0,0,.28);overflow:hidden}.nfd-freeze-step,.nfd-freeze-success{padding:28px}.nfd-freeze-step h2,.nfd-freeze-scroll h2,.nfd-freeze-success h2{margin:0 0 18px}.nfd-freeze-warning{margin:22px 0;padding:13px 15px;border-left:4px solid #b42318;background:#fff5f4}.nfd-freeze-locked{margin:18px 0;padding:14px;border-radius:8px;background:#f2f4f7}.nfd-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:26px}.nfd-btn{border:1px solid #cfd5dc;background:#fff;border-radius:7px;padding:8px 15px;cursor:pointer}.nfd-btn-danger-soft{background:#b42318;color:#fff;border-color:#b42318}.nfd-freeze-scroll{padding:28px;max-height:min(560px,82vh);overflow:auto}.nfd-freeze-summary{display:grid;grid-template-columns:1fr;gap:0;border:1px solid #dde2e7;border-radius:8px;overflow:hidden}.nfd-freeze-summary>div{padding:11px 13px;border-bottom:1px solid #e7eaee}.nfd-freeze-summary span{display:block;font-size:12px;color:#667085}.nfd-freeze-summary strong{display:block;margin-top:2px}.nfd-preflight{margin-top:18px;padding:12px 14px;background:#fff8e8;border:1px solid #f0d99b;border-radius:8px}.nfd-preflight-hard{background:#fff1f0;border-color:#e6aaa5}.nfd-preflight h3{margin:0 0 8px;font-size:14px}.nfd-preflight p{margin:5px 0;font-size:13px}.nfd-freeze-final-zone{min-height:320px;margin-top:26px;padding-top:180px;border-top:1px solid #e4e7ec;text-align:center}.nfd-freeze-final-zone p{font-size:12px;color:#667085}.nfd-atom-button{display:block;margin:14px auto 18px;padding:15px 28px;border-radius:999px;border:5px solid #5b1111;background:linear-gradient(#d9433a,#991b1b);color:#fff;font-weight:800;letter-spacing:.05em;box-shadow:0 7px 0 #641414,0 11px 22px rgba(0,0,0,.25),inset 0 2px 2px rgba(255,255,255,.35);cursor:pointer}.nfd-atom-button:hover{transform:translateY(-1px)}.nfd-atom-button:active{transform:translateY(4px);box-shadow:0 3px 0 #641414,0 6px 12px rgba(0,0,0,.2)}.nfd-atom-button:disabled{opacity:.65;cursor:wait;transform:none}.nfd-freeze-success{text-align:center}.nfd-lock{font-size:42px;margin-bottom:10px}.nfd-overdue{margin:10px 10px 0;padding:9px 10px;border-radius:6px;background:#7f1d1d;color:#fff;font-size:12px;font-weight:700;line-height:1.3}
.next-planning-frozen .upcoming-cell.interactive-cell{pointer-events:none;cursor:default;box-shadow:none!important}.next-planning-frozen .upcoming-cell{background-image:linear-gradient(rgba(220,226,232,.18),rgba(220,226,232,.18))}

/* v0.18e – Docbox-Zuordnung REG + einheitliche Tabellen-Hover */
.nfd-docbox-unassigned-note{margin-top:8px;padding:8px 10px;border-radius:6px;background:#fff4d6;color:#725000;font-size:.88rem}
.reg-docbox-warning{background-image:linear-gradient(rgba(255,236,176,.42),rgba(255,236,176,.42))!important;box-shadow:inset 0 0 0 1px rgba(185,128,0,.22)}
.reg-docbox-warning:hover{box-shadow:inset 0 0 0 1px rgba(185,128,0,.38)!important}
.reg-docbox-personal{font-weight:750}
.reg-docbox-practice{font-weight:400}
.reg-docbox-practice-summary{font-weight:750}

/* v0.18f – REG-Docbox-Darstellung in Gruppenpraxis-Zeilen */
.combo-grid tbody tr.combo-group-child td.upcoming-cell.reg-docbox-warning{background:linear-gradient(rgba(255,236,176,.58),rgba(255,236,176,.58)),var(--nfd-group-bg)!important;box-shadow:inset 0 0 0 1px rgba(185,128,0,.28)!important}
.combo-grid tbody tr.combo-group-child:hover td.upcoming-cell.reg-docbox-warning{background:linear-gradient(rgba(255,236,176,.62),rgba(255,236,176,.62)),var(--nfd-group-hover-bg)!important;box-shadow:inset 0 0 0 1px rgba(185,128,0,.40)!important}

/* v0.19 – Login / Benutzerrollen */
.auth-page{min-height:100vh;margin:0;display:grid;place-items:center;background:#edf1f4;color:#273544;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}.auth-card{width:min(440px,calc(100vw - 32px));background:#fff;border:1px solid #ccd5dc;border-radius:14px;box-shadow:0 18px 50px rgba(26,39,51,.16);padding:30px}.auth-logo{width:52px;height:52px;border-radius:12px;display:grid;place-items:center;background:#315f70;color:#fff;font-weight:800;letter-spacing:.04em;margin-bottom:18px}.auth-card h1{margin:0 0 4px;font-size:24px}.auth-lead{margin:0 0 24px;color:#71808d}.auth-card label{display:block;font-size:13px;font-weight:650;margin:13px 0 0}.auth-card input{display:block;box-sizing:border-box;width:100%;margin-top:6px;padding:10px 11px;border:1px solid #bdc9d2;border-radius:6px;font:inherit;background:#fff}.auth-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}.auth-grid label:nth-child(n+4){grid-column:1/-1}.auth-submit{width:100%;margin-top:20px;padding:11px;border:0;border-radius:6px;background:#315f70;color:#fff;font-weight:750;cursor:pointer}.auth-forgot{display:block;margin:12px auto 0;border:0;background:none;color:#8a98a4}.auth-error{background:#fff2f0;border:1px solid #efc5bd;color:#8a3126;padding:10px 12px;border-radius:6px;margin:0 0 14px}.user-chip{display:flex;align-items:center;gap:8px;max-width:360px;margin-left:auto}.user-avatar{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#e3edf1;border:1px solid #bfd0d8;color:#315f70;font-size:12px;font-weight:800}.user-chip-text{display:flex;flex-direction:column;line-height:1.12;max-width:210px}.user-chip-text strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-chip-text small{font-size:10px;color:#72808c;margin-top:3px}.user-logout{font-size:11px;color:#5d6c77;text-decoration:none;border-left:1px solid #d6dde2;padding-left:8px}.user-logout:hover{color:#9d3028}.authz-readonly{cursor:default!important;box-shadow:none!important}.authz-readonly:hover{background:inherit!important}.authz-hidden{display:none!important}@media(max-width:600px){.auth-grid{grid-template-columns:1fr}.auth-grid label{grid-column:1!important}.user-chip-text{display:none}}

/* =========================================================
   NFD TESTUMGEBUNG – permanenter Sicherheitsbanner
   Wird nur von src/bootstrap.php in APP_ENV=test ausgegeben.
   ========================================================= */
.nfd-test-banner {
    position: sticky;
    top: 0;
    z-index: 10050;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 7px 14px;
    box-sizing: border-box;
    background: #7b2634;
    border-bottom: 2px solid #541923;
    color: #fff;
    font-family: var(--font-ui);
    font-size: 12.5px;
    letter-spacing: .01em;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.nfd-test-banner strong {
    font-size: 13px;
    letter-spacing: .08em;
}
.nfd-test-banner span { opacity: .94; }
@media (max-width: 700px) {
    .nfd-test-banner { flex-direction: column; gap: 1px; text-align: center; }
}
.nfd-test-banner + .app-shell { min-height: 0; }
body:has(> .nfd-test-banner) { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body:has(> .nfd-test-banner) > .nfd-test-banner { flex: 0 0 auto; }
body:has(> .nfd-test-banner) > .app-shell { flex: 1 1 auto; min-height: 0; width: 100%; }
body:has(> .nfd-test-banner) > .app-shell > .sidebar { top: 0; height: 100%; }
.auth-page > .nfd-test-banner {
    position: fixed;
    left: 0;
    right: 0;
}


/* v0.20.1-dev – simulierte Anwendungszeit in der Testumgebung */
.nfd-test-banner{flex-wrap:wrap}.nfd-test-banner-main{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}.nfd-test-clock-status{padding-left:10px;border-left:1px solid rgba(255,255,255,.35);white-space:nowrap}.nfd-test-clock-status.simulated{padding:3px 8px;border:1px solid rgba(255,255,255,.52);border-radius:999px;background:#fff;color:#7b2634;font-weight:700}.nfd-test-clock-form{display:flex;align-items:center;gap:6px;margin:0}.nfd-test-clock-input{height:27px;padding:2px 6px;border:1px solid rgba(255,255,255,.55);border-radius:4px;background:#fff;color:#273544;font:inherit}.nfd-test-clock-form button{height:27px;padding:2px 8px;border:1px solid rgba(255,255,255,.58);border-radius:4px;background:rgba(255,255,255,.12);color:#fff;font:inherit;font-weight:650;cursor:pointer}.nfd-test-clock-form button:hover{background:rgba(255,255,255,.22)}
@media(max-width:900px){.nfd-test-banner{position:relative}.nfd-test-banner-main,.nfd-test-clock-form{width:100%;justify-content:center}.nfd-test-banner + .app-shell>.sidebar{top:0;height:100%}}
.nfd-test-reset-link{height:27px;display:inline-flex;align-items:center;padding:2px 8px;border:1px solid rgba(255,255,255,.58);border-radius:4px;background:rgba(255,255,255,.12);color:#fff;text-decoration:none;font-weight:650;box-sizing:border-box}.nfd-test-reset-link:hover{background:rgba(255,255,255,.22)}
.nfd-test-reset-page{min-height:calc(100vh - 44px);background:#f4f7f9;padding:32px 18px;box-sizing:border-box}.nfd-test-reset-card{max-width:820px;margin:0 auto;background:#fff;border:1px solid #d8e0e6;border-radius:10px;box-shadow:0 3px 14px rgba(30,48,65,.08);padding:24px}.nfd-test-reset-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;border-bottom:1px solid #e0e6eb;padding-bottom:18px;margin-bottom:20px}.nfd-test-reset-head h1{margin:0 0 6px;font-size:22px}.nfd-test-reset-head p{margin:0;color:#607080;line-height:1.45}.nfd-test-reset-box{border:1px solid #d8e0e6;border-radius:8px;padding:18px;margin-top:16px}.nfd-test-reset-box h2{font-size:17px;margin:0 0 10px}.nfd-test-reset-box p{line-height:1.45}.nfd-test-reset-box.baseline-ready{background:#f3f8f4;border-color:#b9d5c0}.nfd-test-reset-box.danger{background:#fff8f7;border-color:#e7b8b3}.nfd-test-reset-note{padding:10px 12px;background:#fff8e8;border:1px solid #ead19a;border-radius:6px}.nfd-test-reset-box label{display:block;margin:16px 0 12px}.nfd-test-reset-box input[name=confirm]{display:block;width:220px;max-width:100%;margin-top:6px;padding:9px;border:1px solid #b8c5cf;border-radius:5px;font:inherit}.nfd-test-reset-danger{border:1px solid #9d2925;background:#b63832;color:#fff;border-radius:6px;padding:10px 14px;font-weight:750;cursor:pointer}.nfd-test-reset-danger:hover{background:#9f2d28}.nfd-test-reset-ok,.nfd-test-reset-error{padding:11px 13px;border-radius:6px;margin-bottom:14px}.nfd-test-reset-ok{background:#edf7ef;border:1px solid #afd0b6;color:#245b31}.nfd-test-reset-error{background:#fff0ef;border:1px solid #e1aaa6;color:#8b2925}
.audit-filter{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:10px}.audit-filter label{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:700}.audit-filter input,.audit-filter select{min-height:36px;padding:6px 8px;border:1px solid #cbd3da;border-radius:6px;background:#fff}.audit-note{font-size:12px;color:#66727d;margin:6px 0 12px}.audit-table{font-size:12px}.audit-table td{vertical-align:top}.audit-table small{display:block;color:#6d7882;margin-top:3px}.audit-table details{max-width:420px}.audit-table summary{cursor:pointer}.audit-table pre{white-space:pre-wrap;word-break:break-word;max-height:240px;overflow:auto;background:#f5f7f8;padding:8px;border-radius:5px;font-size:11px}

/* v0.31 personal settings */
.settings-wrap{padding:24px;max-width:980px}.settings-card{background:#fff;border:1px solid #d6dde1;border-radius:10px;overflow:hidden}.settings-row{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:28px;align-items:center;padding:20px 22px;border-bottom:1px solid #e3e8eb}.settings-row h2{margin:0 0 5px;font-size:16px}.settings-row p{margin:0;color:#65757e;font-size:12px;line-height:1.45}.settings-row select{width:100%;box-sizing:border-box;padding:9px 10px;border:1px solid #bcc8ce;border-radius:6px;background:#fff;font:inherit}.settings-row small{display:block;margin-top:6px;color:#7d8b93;font-size:11px}.settings-check{display:flex;gap:8px;align-items:center;font-size:13px}.settings-disabled{background:#f7f8f9;color:#7d878d}.settings-disabled select,.settings-disabled input{opacity:.55}.settings-actions{padding:18px 22px;text-align:right}.settings-status{padding:11px 13px;border-radius:7px;margin:0 0 14px;font-size:13px}.settings-status.ok{background:#e7f3eb;border:1px solid #c6dfcf}.settings-status.err{background:#f9e3e3;border:1px solid #ebc3c3;color:#8a3030}@media(max-width:760px){.settings-row{grid-template-columns:1fr;gap:12px}.settings-wrap{padding:14px}}

/* v0.33-dev: regionales Umfrage-Controlling */
.group-survey{background:#eee9f5!important;color:#4d3d66!important}
.survey-head{background:#f4f0f9!important;min-width:76px;width:76px;max-width:76px;cursor:pointer;user-select:none}
.survey-head:hover{filter:brightness(.98)}
.survey-cell{min-width:76px;width:76px;max-width:76px;text-align:center;font-weight:800;font-size:18px;transition:background .12s ease,box-shadow .12s ease}
.survey-cell.survey-inactive{background:transparent;color:#9aa4ad;font-weight:500}
.survey-cell.survey-open{background:#fdeaea!important;color:#9d2f2f}
.survey-cell.survey-checked{background:#e6f4e8!important;color:#2f8a4e}
.survey-cell.survey-editable{cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}
.survey-cell.survey-editable:hover{filter:brightness(.975);box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.survey-cell.survey-readonly{cursor:default}
.survey-control-overview{display:grid;gap:7px;margin:0 0 14px}.survey-control-overview-row{display:grid;grid-template-columns:minmax(150px,1fr) 2fr;gap:12px;padding:7px 9px;border:1px solid #dde3e8;border-radius:7px;background:#fafbfc}.survey-control-overview-row strong{font-size:13px}.survey-region-choices .survey-control-overview-row{width:100%;text-align:left;font:inherit;cursor:pointer}.survey-region-choices .survey-control-overview-row:hover{border-color:#b9c8d2;background:#f5f8fa}.survey-region-choices .survey-control-overview-row.is-selected{border-color:#6d9bac;background:#edf5f7;box-shadow:inset 3px 0 0 #3c7285}.survey-control-overview-row span{font-size:13px;color:#51606d}.survey-control-manage{border-top:1px solid #dde3e8;padding-top:14px;margin-top:10px}.survey-radio-row{display:flex;align-items:center;gap:8px;margin:9px 0}.survey-radio-row input[type="text"]{flex:1;min-width:160px}.survey-dialog-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:16px}.survey-dialog-actions .danger{border-color:#ca6a6a;color:#9b2929;background:#fff5f5}.survey-dialog-actions .danger:disabled{border-color:#cbd3d9;color:#8b979f;background:#eef1f3;cursor:not-allowed;opacity:.75}.survey-readonly-note{font-size:13px;color:#6f7e8a;margin-top:12px}

/* ==========================================================
   v0.35 – Tabellen-Feinschliff: Sticky-Gruppenkopf + Spaltenresize
   ========================================================== */
.data-grid thead .group-sticky-cover {
    position: sticky !important;
    left: 0;
    z-index: 10 !important;
    background: var(--surface-header) !important;
    box-shadow: 2px 0 3px rgba(0,0,0,.08);
}
.data-grid thead .group-person-scroll { background: var(--surface-header) !important; }
.data-grid thead tr:not(.group-row) th { position: sticky; }
.nfd-col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    z-index: 20;
    cursor: col-resize;
    touch-action: none;
}
.nfd-col-resizer::after {
    content: '';
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: 3px;
    width: 1px;
    background: transparent;
}
.data-grid thead th:hover > .nfd-col-resizer::after,
body.nfd-column-resizing .nfd-col-resizer::after { background: #91a8b8; }
body.nfd-column-resizing { cursor: col-resize !important; user-select: none !important; }
body.nfd-column-resizing * { cursor: col-resize !important; }

/* Restriktive Farbpalette für Planungskommentare */
.note-color-red { color: #9b5555; }
.note-color-orange { color: #9a6a3a; }
.note-color-green { color: #4f7b61; }
.note-color-blue { color: #4f6f8f; }
.note-color-violet { color: #75618d; }
.nfd-note-color-wrap { position: relative; display: inline-flex; }
.nfd-note-color-a { font-weight: 800; border-bottom: 3px solid #4f6f8f; line-height: 1.05; }
.nfd-note-color-palette {
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    display: flex;
    gap: 3px;
    padding: 4px;
    border: 1px solid #bcc8cd;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(24,39,46,.18);
}
.nfd-note-color-palette[hidden] { display: none; }
.nfd-note-color-palette button { min-width: 25px; width: 25px; padding: 2px; }
.note-swatch { display:block; width:15px; height:15px; border-radius:3px; background: currentColor; border:1px solid rgba(0,0,0,.12); }
.note-swatch-default { font-size:18px !important; line-height:1; color:#56636b !important; }

/* ==========================================================
   v0.36 – Persönliche Farbthemen
   Standard bleibt unverändert. Zusätzliche Themes überschreiben
   ausschließlich zentrale Farbvariablen bzw. notwendige Oberflächen.
   ========================================================== */
:root {
    --nfd-note-red: #9b5555;
    --nfd-note-orange: #9a6a3a;
    --nfd-note-green: #4f7b61;
    --nfd-note-blue: #4f6f8f;
    --nfd-note-violet: #75618d;
    --nfd-docbox-warning-overlay: rgba(255,236,176,.42);
    --nfd-docbox-warning-overlay-strong: rgba(255,236,176,.58);
}

body[data-theme="intensiv"] {
    --nfd-dispensation-overlay: rgba(20, 145, 126, .34);
    --nfd-dispensation-overlay-hover: rgba(20, 145, 126, .42);
    --nfd-manual-overlay: rgba(196, 48, 122, .35);
    --nfd-manual-border: rgba(164, 36, 101, .34);
    --nfd-cave-bg: #ffe277;
    --nfd-cave-border: #c99a00;
    --nfd-cave-symbol: #b52222;
    --nfd-age-60-bg: #f3e7a8;
    --nfd-age-65-bg: #f2c979;
    --nfd-age-70-bg: #ee9e98;
    --nfd-freeze-bg: #e7edf1;
    --nfd-freeze-header-bg: #d3dde4;
    --nfd-current-bg: #f8fafb;
    --nfd-current-header-bg: #e9eef2;
    --nfd-upcoming-bg: #ffe9dc;
    --nfd-upcoming-header-bg: #f6cdb8;
    --nfd-comments-bg: #f8f5ec;
    --nfd-comments-header-bg: #eae3d5;
    --nfd-note-red: #b32f3b;
    --nfd-note-orange: #b86718;
    --nfd-note-green: #2f7f4f;
    --nfd-note-blue: #2f68a2;
    --nfd-note-violet: #7447a1;
    --nfd-docbox-warning-overlay: rgba(255,205,55,.52);
    --nfd-docbox-warning-overlay-strong: rgba(255,205,55,.66);
}

body[data-theme="dunkel"] {
    color-scheme: dark;
    --border: #46515b;
    --border-strong: #596671;
    --surface: #242b31;
    --surface-soft: #1b2025;
    --surface-header: #303941;
    --surface-row-alt: #22292f;
    --surface-row-hover: #303b43;
    --text: #e3e8ec;
    --text-muted: #a8b3bc;
    --text-heading: #f0f3f5;
    --text-link: #8fc5e6;
    --plan-bg: #242d34;
    --live-bg: #242b31;
    --historical-bg: #30343a;
    --nfd-group-bg: #303445;
    --nfd-group-header-bg: #3a4055;
    --nfd-group-hover-bg: #383d50;
    --nfd-freeze-bg: #2a3137;
    --nfd-freeze-header-bg: #343d44;
    --nfd-current-bg: #242b31;
    --nfd-current-header-bg: #30383f;
    --nfd-upcoming-bg: #342c29;
    --nfd-upcoming-header-bg: #493831;
    --nfd-comments-bg: #302f2b;
    --nfd-comments-header-bg: #3d3a33;
    --nfd-dispensation-overlay: rgba(57,132,124,.28);
    --nfd-dispensation-overlay-hover: rgba(57,132,124,.36);
    --nfd-manual-overlay: rgba(184,70,126,.30);
    --nfd-manual-border: rgba(210,105,157,.28);
    --nfd-age-60-bg: #494632;
    --nfd-age-65-bg: #55452f;
    --nfd-age-70-bg: #583837;
    --nfd-note-red: #c77b7b;
    --nfd-note-orange: #c8945f;
    --nfd-note-green: #78a889;
    --nfd-note-blue: #7fa1c2;
    --nfd-note-violet: #a18ab9;
}

.note-color-red { color: var(--nfd-note-red) !important; }
.note-color-orange { color: var(--nfd-note-orange) !important; }
.note-color-green { color: var(--nfd-note-green) !important; }
.note-color-blue { color: var(--nfd-note-blue) !important; }
.note-color-violet { color: var(--nfd-note-violet) !important; }

/* Docbox-Warnung folgt ebenfalls der Theme-Sättigung. */
.reg-docbox-warning { background-image:linear-gradient(var(--nfd-docbox-warning-overlay),var(--nfd-docbox-warning-overlay))!important; }
.combo-grid tbody tr.combo-group-child td.upcoming-cell.reg-docbox-warning { background:linear-gradient(var(--nfd-docbox-warning-overlay-strong),var(--nfd-docbox-warning-overlay-strong)),var(--nfd-group-bg)!important; }

/* Dunkel: nur die angemeldete Arbeitsoberfläche; Login/Onboarding bleiben hell. */
body[data-theme="dunkel"],
body[data-theme="dunkel"] .main,
body[data-theme="dunkel"] .members-main { background:var(--surface-soft); color:var(--text); }
body[data-theme="dunkel"] .topbar,
body[data-theme="dunkel"] .toolbar,
body[data-theme="dunkel"] .members-toolbar,
body[data-theme="dunkel"] .settings-card,
body[data-theme="dunkel"] .member-card,
body[data-theme="dunkel"] .members-empty,
body[data-theme="dunkel"] .card,
body[data-theme="dunkel"] .modal,
body[data-theme="dunkel"] .nfd-modal,
body[data-theme="dunkel"] .nfd-freeze-dialog,
body[data-theme="dunkel"] .survey-control-overview-row { background:var(--surface); color:var(--text); border-color:var(--border); }
body[data-theme="dunkel"] .data-grid th,
body[data-theme="dunkel"] .member-table th { background:var(--surface-header); color:var(--text-muted); border-color:var(--border); }
body[data-theme="dunkel"] .data-grid td,
body[data-theme="dunkel"] .member-table td { border-color:var(--border); color:var(--text); }
body[data-theme="dunkel"] input,
body[data-theme="dunkel"] select,
body[data-theme="dunkel"] textarea,
body[data-theme="dunkel"] .member-note-editor,
body[data-theme="dunkel"] .member-combo>input,
body[data-theme="dunkel"] .member-form-grid input,
body[data-theme="dunkel"] .member-form-grid select,
body[data-theme="dunkel"] .status-box input,
body[data-theme="dunkel"] .wide-select,
body[data-theme="dunkel"] .specialty-add select,
body[data-theme="dunkel"] .member-table input,
body[data-theme="dunkel"] .member-table select { background:#20272c; color:var(--text); border-color:var(--border-strong); }
body[data-theme="dunkel"] button:not(.nav-item):not(.nfd-test-reset-danger):not(.nfd-atom-button),
body[data-theme="dunkel"] .secondary-btn,
body[data-theme="dunkel"] .members-save { background:#30383f; color:var(--text); border-color:var(--border-strong); }
body[data-theme="dunkel"] button:not(.nav-item):not(.nfd-test-reset-danger):not(.nfd-atom-button):hover { background:#39444c; }
body[data-theme="dunkel"] .settings-row { border-color:var(--border); }
body[data-theme="dunkel"] .settings-row p,
body[data-theme="dunkel"] .settings-row small,
body[data-theme="dunkel"] .member-card p,
body[data-theme="dunkel"] .field-caption,
body[data-theme="dunkel"] .member-form-grid label,
body[data-theme="dunkel"] .status-box label,
body[data-theme="dunkel"] .audit-note { color:var(--text-muted); }
body[data-theme="dunkel"] .specialty-row,
body[data-theme="dunkel"] .member-picker-menu,
body[data-theme="dunkel"] .member-picker-menu button { background:#252d33; color:var(--text); border-color:var(--border); }
body[data-theme="dunkel"] .member-picker-menu button:hover { background:#344049; }
body[data-theme="dunkel"] .member-card h2,
body[data-theme="dunkel"] .topbar h1,
body[data-theme="dunkel"] .settings-row h2 { color:var(--text-heading); }
body[data-theme="dunkel"] .doctor-name,
body[data-theme="dunkel"] .practice-link { color:var(--text-link); }
body[data-theme="dunkel"] .notes-cell { color:#bdc6cd; }
body[data-theme="dunkel"] .snapshot-note { background:#34383d!important; color:#bdc5cc; }
body[data-theme="dunkel"] .snapshot-note-head,
body[data-theme="dunkel"] .inactive-head { background:#353a3f!important; color:#9ca6ad!important; }
body[data-theme="dunkel"] .inactive-cell { background:#30343a!important; color:#8e989f!important; }
body[data-theme="dunkel"] .table-legend-footer { background:var(--surface); border-color:var(--border); }
body[data-theme="dunkel"] .nfd-note-toolbar,
body[data-theme="dunkel"] .nfd-note-color-palette { background:#293138; color:var(--text); border-color:var(--border-strong); }
body[data-theme="dunkel"] .nfd-note-toolbar button { color:var(--text); }
body[data-theme="dunkel"] .nfd-note-toolbar button:hover { background:#3a454d; }
body[data-theme="dunkel"] .survey-control-overview-row span,
body[data-theme="dunkel"] .survey-readonly-note { color:var(--text-muted); }
body[data-theme="dunkel"] .note { color:var(--text-muted); }
body[data-theme="dunkel"] .nfd-test-reset-page { background:var(--surface-soft); color:var(--text); }
body[data-theme="dunkel"] .nfd-test-reset-card,
body[data-theme="dunkel"] .nfd-test-reset-box { background:var(--surface); color:var(--text); border-color:var(--border); }
body[data-theme="dunkel"] .nfd-test-reset-head { border-color:var(--border); }
body[data-theme="dunkel"] .nfd-test-reset-head p { color:var(--text-muted); }

/* ==========================================================
   v0.36a – Dunkel-Theme Feinschliff
   Nur für das Theme "Dunkel"; Standard/Intensiv bleiben unverändert.
   ========================================================== */
body[data-theme="dunkel"] .settings-status.ok,
body[data-theme="dunkel"] .status.ok,
body[data-theme="dunkel"] .nfd-test-reset-ok {
    background:#20372a !important;
    border-color:#3e6650 !important;
    color:#cfe8d7 !important;
}
body[data-theme="dunkel"] .settings-status.err,
body[data-theme="dunkel"] .status.err,
body[data-theme="dunkel"] .nfd-test-reset-error {
    background:#412728 !important;
    border-color:#704345 !important;
    color:#efc7c7 !important;
}

/* Dialoge: Header, Body und Footer konsequent dunkel. */
body[data-theme="dunkel"] .nfd-modal-header,
body[data-theme="dunkel"] .nfd-modal-footer {
    background:#2b343b !important;
    color:var(--text) !important;
    border-color:var(--border) !important;
}
body[data-theme="dunkel"] .nfd-modal-body { background:var(--surface) !important; color:var(--text) !important; }
body[data-theme="dunkel"] .nfd-modal-header h2,
body[data-theme="dunkel"] .nfd-modal-subtitle { color:var(--text-heading) !important; }
body[data-theme="dunkel"] .nfd-modal-subtitle,
body[data-theme="dunkel"] .nfd-help-text,
body[data-theme="dunkel"] .locality-note,
body[data-theme="dunkel"] .status-date-help { color:var(--text-muted) !important; }
body[data-theme="dunkel"] .nfd-modal-close { color:#c8d1d7 !important; }

/* Neutrale/alternierende Tabellenflächen und Hover im Dunkel-Theme. */
body[data-theme="dunkel"] .data-grid tbody tr { background:var(--surface) !important; }
body[data-theme="dunkel"] .data-grid tbody tr:nth-child(even) { background:var(--surface-row-alt) !important; }
body[data-theme="dunkel"] .data-grid tbody tr:hover { background:var(--surface-row-hover) !important; }
body[data-theme="dunkel"] .doctor-grid tbody td.sticky-col,
body[data-theme="dunkel"] .practice-grid tbody td.p-sticky,
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.c-sticky {
    background:var(--surface) !important;
}
body[data-theme="dunkel"] .doctor-grid tbody tr:nth-child(even) td.sticky-col,
body[data-theme="dunkel"] .practice-grid tbody tr:nth-child(even) td.p-sticky,
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):nth-child(even) td.c-sticky {
    background:var(--surface-row-alt) !important;
}
body[data-theme="dunkel"] .doctor-grid tbody tr:hover td.sticky-col,
body[data-theme="dunkel"] .practice-grid tbody tr:hover td.p-sticky,
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):hover td.c-sticky {
    background:var(--surface-row-hover) !important;
}
/* Semantische Gruppen-/Dispensationsfarben haben weiterhin Vorrang. */
body[data-theme="dunkel"] .combo-grid tbody tr.combo-practice-row,
body[data-theme="dunkel"] .combo-grid tbody tr.combo-group-child { background:transparent !important; }

/* Praxisliste: normale Planfläche + Override nicht in hellem Standardrosa. */
body[data-theme="dunkel"] .practice-grid .plan-cell { background:#2a3238 !important; color:var(--text) !important; }
body[data-theme="dunkel"] .practice-grid td.manual-adjusted-cell {
    background:linear-gradient(var(--nfd-manual-overlay),var(--nfd-manual-overlay)),#2a3238 !important;
    box-shadow:inset 0 0 0 1px var(--nfd-manual-border) !important;
}
body[data-theme="dunkel"] .informative-dp,
body[data-theme="dunkel"] .doctors-cell,
body[data-theme="dunkel"] .docbox-login-cell,
body[data-theme="dunkel"] .muted-cell { color:var(--text-muted) !important; }

/* Hover: keine hellen Flash-Flächen. */
body[data-theme="dunkel"] .data-grid th.sortable:hover,
body[data-theme="dunkel"] .filter-btn:hover,
body[data-theme="dunkel"] .entity-edit-link:hover { background:#39444c !important; }
body[data-theme="dunkel"] .data-grid td.interactive-cell:hover { filter:none !important; box-shadow:inset 0 0 0 1px #60717c !important; }
body[data-theme="dunkel"] .doctor-grid tbody tr:hover td.freeze-cell,
body[data-theme="dunkel"] .doctor-grid tbody tr:hover td.current-cell,
body[data-theme="dunkel"] .doctor-grid tbody tr:hover td.upcoming-cell,
body[data-theme="dunkel"] .doctor-grid tbody tr:hover td.comments-cell { filter:brightness(1.08); }

/* Dialog-Inhalte / Hinweise für dunklen Hintergrund. */
body[data-theme="dunkel"] .nfd-dialog-context,
body[data-theme="dunkel"] .nfd-fee-box,
body[data-theme="dunkel"] .nfd-choice-card,
body[data-theme="dunkel"] .nfd-duration-preview,
body[data-theme="dunkel"] .nfd-freeze-locked,
body[data-theme="dunkel"] .nfd-freeze-summary,
body[data-theme="dunkel"] .nfd-freeze-summary>div {
    background:#293138 !important;
    color:var(--text) !important;
    border-color:var(--border) !important;
}
body[data-theme="dunkel"] .nfd-dialog-context span,
body[data-theme="dunkel"] .nfd-dialog-subtitle,
body[data-theme="dunkel"] .nfd-field-label,
body[data-theme="dunkel"] .nfd-form label,
body[data-theme="dunkel"] .nfd-freeze-summary span,
body[data-theme="dunkel"] .nfd-freeze-final-zone p { color:var(--text-muted) !important; }
body[data-theme="dunkel"] .nfd-choice-card.is-active { background:#324048 !important; border-color:#668593 !important; }

/* Gelbe/rote Informationsboxen: gedämpft, aber gut lesbar. */
body[data-theme="dunkel"] .member-inline-warning,
body[data-theme="dunkel"] .nfd-warning-note,
body[data-theme="dunkel"] .nfd-info-note,
body[data-theme="dunkel"] .nfd-preflight,
body[data-theme="dunkel"] .nfd-test-reset-note,
body[data-theme="dunkel"] .nfd-docbox-unassigned-note {
    background:#42391f !important;
    border-color:#73622d !important;
    color:#eadca7 !important;
}
body[data-theme="dunkel"] .nfd-freeze-warning,
body[data-theme="dunkel"] .nfd-preflight-hard {
    background:#44292a !important;
    border-color:#814949 !important;
    color:#efcaca !important;
}

/* Tabellen-/Dialog-Hilfselemente. */
body[data-theme="dunkel"] .nfd-mutation-list-wrap,
body[data-theme="dunkel"] .nfd-mutation-list th,
body[data-theme="dunkel"] .nfd-empty-state { border-color:var(--border) !important; }
body[data-theme="dunkel"] .nfd-mutation-list th { background:#303941 !important; color:var(--text-muted) !important; }
body[data-theme="dunkel"] .nfd-mutation-list td { border-color:var(--border) !important; }
body[data-theme="dunkel"] .nfd-mutation-list tr.js-mutation-row:hover td { background:#303b43 !important; }
body[data-theme="dunkel"] .nfd-mutation-list tr.js-mutation-row.selected td { background:#334650 !important; }
body[data-theme="dunkel"] .nfd-input-suffix b { background:#30383f !important; color:var(--text-muted) !important; border-color:var(--border-strong) !important; }
body[data-theme="dunkel"] .table-legend-footer strong { color:#c7d0d6 !important; }

/* ==========================================================
   v0.36b – Dunkel-Theme Rest-Feinschliff
   Nur Theme "Dunkel"; Standard/Intensiv bleiben unverändert.
   ========================================================== */
/* Altersmarkierungen müssen auch gegen Zebra-/Gruppenflächen Vorrang behalten. */
body[data-theme="dunkel"] .doctor-grid tbody td.age-60,
body[data-theme="dunkel"] .combo-grid tbody td.age-60 { background:var(--nfd-age-60-bg) !important; color:#f1eccf !important; }
body[data-theme="dunkel"] .doctor-grid tbody td.age-65,
body[data-theme="dunkel"] .combo-grid tbody td.age-65 { background:var(--nfd-age-65-bg) !important; color:#f4dfb8 !important; }
body[data-theme="dunkel"] .doctor-grid tbody td.age-70,
body[data-theme="dunkel"] .combo-grid tbody td.age-70 { background:var(--nfd-age-70-bg) !important; color:#f2cecc !important; }

/* Umfrage-Controlling: Header und Statusflächen dunkel-tauglich. */
body[data-theme="dunkel"] .group-survey { background:#373245 !important; color:#d7c8ed !important; }
body[data-theme="dunkel"] .survey-head { background:#302d3a !important; color:#c7b6dd !important; }
body[data-theme="dunkel"] .survey-head:hover { background:#393443 !important; filter:none !important; }
body[data-theme="dunkel"] .data-grid tbody td.survey-cell.survey-inactive { background:var(--surface) !important; color:#7f8b94 !important; }
body[data-theme="dunkel"] .data-grid tbody td.survey-cell.survey-open { background:#4a2f31 !important; color:#efaaaa !important; }
body[data-theme="dunkel"] .data-grid tbody td.survey-cell.survey-checked { background:#294235 !important; color:#9fd6b0 !important; }
body[data-theme="dunkel"] .data-grid tbody tr:hover td.survey-cell.survey-open { background:#563638 !important; }
body[data-theme="dunkel"] .data-grid tbody tr:hover td.survey-cell.survey-checked { background:#31503f !important; }

/* Praxisliste: Freeze-Gruppenheader im Dunkel-Theme. */
body[data-theme="dunkel"] .practice-grid .group-plan {
    background:var(--nfd-freeze-header-bg) !important;
    color:#c7d1d8 !important;
}

/* Dienstplanungsdialoge: Docbox-Bereich und deaktivierte Felder nicht hell darstellen. */
body[data-theme="dunkel"] .nfd-docbox-plan {
    background:#30383e !important;
    border-color:#596671 !important;
    color:var(--text) !important;
}
body[data-theme="dunkel"] .nfd-docbox-plan .nfd-field-label { color:#c0c9cf !important; }
body[data-theme="dunkel"] .nfd-choice-content input:disabled,
body[data-theme="dunkel"] .nfd-choice-content textarea:disabled,
body[data-theme="dunkel"] .nfd-readonly-percent input:disabled,
body[data-theme="dunkel"] .nfd-readonly-percent input {
    background:#343c42 !important;
    color:#9eabb3 !important;
    border-color:#53606a !important;
    -webkit-text-fill-color:#9eabb3;
    opacity:1;
}
body[data-theme="dunkel"] .nfd-choice-content textarea,
body[data-theme="dunkel"] .nfd-choice-content input {
    border-color:#596671;
}

/* v0.50-beta4 – Admin-Benutzerdialog: kompakte Checkboxzeilen + sicher sichtbarer Footer */
#userModal .compact-modal{height:min(760px,calc(100vh - 48px))}
#userModal .member-form-grid label.nfd-check-row{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;padding:5px 0}
#userModal .member-form-grid label.nfd-check-row>input[type="checkbox"]{flex:0 0 auto;width:18px;height:18px;margin:0;padding:0}
#userModal .member-form-grid label.nfd-check-row>span{display:inline;min-width:0}
#userModal .admin-region-options{display:grid;gap:1px}
#userModal .admin-region-fieldset{padding-top:7px;padding-bottom:7px}

/* v0.52-beta – Listenviewport inkl. Footerlegende: nur Tabellenbereich scrollt */
.table-scroll{max-height:calc(100vh - 205px)}

/* v0.52a-beta – Regression-Fix: Dirty-State und Beta-Test-Menüblock */
.members-save.is-dirty {
    background:#b93b3b !important;
    border-color:#a93232 !important;
    color:#fff !important;
}
.members-save.is-dirty:hover {
    background:#a93232 !important;
    border-color:#982b2b !important;
    color:#fff !important;
}

.beta-nav-block {
    margin:10px 6px 4px;
    padding:7px 6px 8px;
    border:1px solid rgba(210,174,235,.32);
    border-radius:7px;
    background:rgba(126,75,159,.22);
}
.beta-nav-block .beta-nav-title {
    margin-top:0;
    color:#e7c4ff !important;
}
.beta-nav-block .nav-item {
    border-radius:5px;
}
.beta-nav-block .nav-item:hover {
    background:rgba(255,255,255,.10);
}
.beta-nav-block .nav-item.active {
    background:rgba(255,255,255,.16);
}

/* v0.53-beta – historisches AP-Startpensum geschützt */
.nfd-mutation-row-locked{cursor:not-allowed!important;opacity:.58;background:#f3f5f6!important}
.nfd-mutation-row-locked:hover{background:#f3f5f6!important}
.nfd-ap-history-hint{margin:10px 0 12px}
.audit-object-label{display:block;margin-top:2px;font-weight:600;color:#263f4b}


/* v0.53a-beta – Regression-Fix: Admin-Dialog-Footer dauerhaft sichtbar */
#userModal .compact-modal{
    height:min(760px,calc(100vh - 48px));
    max-height:calc(100vh - 48px);
    overflow:hidden;
}
#userModal .compact-modal > form{
    display:flex;
    flex-direction:column;
    flex:1 1 auto;
    min-height:0;
    overflow:hidden;
}
#userModal .compact-modal > form > .nfd-modal-body{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
}
#userModal .compact-modal > form > .nfd-modal-footer{
    flex:0 0 auto;
}
/* v0.54 – situative Ausnahme-Liste */
.sidebar .nav-item.nfd-warning-nav{font-weight:700;background:rgba(238,168,35,.16);border-left:3px solid #d89416;}
.nfd-global-dialog-input{width:100%;margin-top:14px;padding:9px 10px;border:1px solid #b9c7cf;border-radius:6px;font:inherit;}
/* v0.55 Dienstpensum-Regeln */
.duty-rules-wrap{padding:16px 18px 28px}.duty-rules-toolbar{display:flex;align-items:end;gap:18px;padding:12px 14px;background:#fff;border:1px solid #d7e0e5;border-radius:8px;margin-bottom:12px}.duty-rules-toolbar label{font-weight:700;min-width:220px}.duty-rules-toolbar select{display:block;width:100%;margin-top:5px;padding:7px;border:1px solid #b9c9d2;border-radius:5px}.duty-rules-toolbar span{font-size:11px;color:#617178;padding-bottom:7px}.rule-tabs{display:flex;gap:5px;margin-bottom:8px}.rule-tab{border:1px solid #b9c9d2;background:#eef3f6;padding:8px 14px;border-radius:6px 6px 0 0;cursor:pointer}.rule-tab.active{background:#fff;border-bottom-color:#fff;font-weight:700}.rule-card{background:#fff;border:1px solid #d7e0e5;border-radius:0 8px 8px 8px;padding:16px}.rule-grid{display:grid;grid-template-columns:minmax(420px,1fr) minmax(420px,1.15fr);gap:28px}.rule-grid h2{font-size:14px;margin:4px 0 10px}.rule-grid section>label{display:grid;grid-template-columns:180px 1fr;align-items:center;gap:10px;margin:7px 0;font-size:12px;font-weight:700}.rule-grid select,.rule-grid input{padding:7px;border:1px solid #b9c9d2;border-radius:5px}.rule-inactive{display:grid;grid-template-columns:180px 70px 1fr;gap:10px;align-items:center;margin:8px 0 18px;padding:8px;background:#f4f6f7;color:#718087;border-radius:5px;font-size:11px}.age-rule-row{display:grid;grid-template-columns:120px 170px 150px 150px 34px;gap:7px;align-items:end;margin:6px 0}.age-rule-row label{font-size:10px;font-weight:700}.age-rule-row input{display:block;width:100%;box-sizing:border-box;margin-top:3px}.age-rule-row small{display:block;font-weight:400;color:#78878e;margin-top:2px}.inactive-field{opacity:.58}.ageDel{height:32px;border:1px solid #d0d9de;background:#fff;border-radius:5px;cursor:pointer}.rule-help{font-size:10px;color:#687980}.rule-actions{display:flex;justify-content:flex-end;align-items:center;gap:12px;border-top:1px solid #e1e7ea;margin-top:16px;padding-top:12px}.rule-preview{border-collapse:collapse;width:100%;font-size:11px}.rule-preview th,.rule-preview td{border:1px solid #d9e1e5;padding:6px;text-align:right}.rule-preview thead th{background:#edf2f5}.rule-preview tbody th{background:#f6f8f9}.preview-scroll{overflow:auto}@media(max-width:1100px){.rule-grid{grid-template-columns:1fr}.age-rule-row{grid-template-columns:110px 150px 130px 130px 34px}}
/* v0.55a Dienstpensum-Regeln – nur kommende Planungsperiode + Dirty-State */
.rule-period-readonly{display:block;box-sizing:border-box;width:100%;margin-top:5px;padding:7px 9px;border:1px solid #c8d2d8;border-radius:5px;background:#eef2f4;color:#31454e;font-weight:700;cursor:default}.rule-actions .rule-save-dirty{background:#b42318!important;border-color:#941c13!important;color:#fff!important;box-shadow:0 0 0 2px rgba(180,35,24,.10)}.rule-actions .rule-save-dirty:hover{background:#991f17!important}

/* v0.56-beta: security-monitor trigger emphasis */
.audit-table tr.audit-security-trigger>td{background:#fff0f0;border-top-color:#e6a1a1;border-bottom-color:#e6a1a1}.audit-table tr.audit-security-trigger td:nth-child(3) strong,.audit-table tr.audit-security-trigger td:nth-child(5){color:#b42318;font-weight:800}body[data-theme="dunkel"] .audit-table tr.audit-security-trigger>td{background:#482626}body[data-theme="dunkel"] .audit-table tr.audit-security-trigger td:nth-child(3) strong,body[data-theme="dunkel"] .audit-table tr.audit-security-trigger td:nth-child(5){color:#ffb4ab}
/* v0.57 Statistik / Export */
.stats-wrap{padding:22px;display:grid;gap:18px}.stats-toolbar{display:flex;justify-content:space-between;align-items:end;gap:16px}.stats-toolbar label{display:grid;gap:6px;font-weight:700}.stats-toolbar select{min-width:290px;padding:9px 11px;border:1px solid #cfd8df;border-radius:8px;background:var(--surface,#fff);color:inherit}.stats-grid{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(340px,.75fr);gap:18px}.stat-card{background:var(--surface,#fff);border:1px solid #dce3e8;border-radius:12px;padding:18px;box-shadow:0 1px 3px rgba(0,0,0,.04)}.stat-card h2{font-size:17px;margin:0 0 14px}.stats-table{width:100%;border-collapse:collapse}.stats-table th,.stats-table td{padding:9px 10px;border-bottom:1px solid #e6ebef;text-align:left;vertical-align:top}.stats-table th{font-weight:600;width:48%}.stats-table td{font-variant-numeric:tabular-nums}.export-card p{margin:0 0 14px;color:#61707b}.export-buttons{display:flex;flex-wrap:wrap;gap:10px}.export-buttons a{display:inline-flex;padding:9px 13px;border:1px solid #c7d3da;border-radius:8px;text-decoration:none;color:inherit;background:var(--surface,#fff);font-weight:650}.export-buttons a:hover{border-color:#7b98a7}@media(max-width:1000px){.stats-grid{grid-template-columns:1fr}.stats-toolbar{align-items:stretch;flex-direction:column}.stats-toolbar select{width:100%;min-width:0}}
/* v0.58-beta: NFD-Dienstpflicht – bewusst nur Ergänzungen, bestehendes Layout unverändert */
.duty-obligation-card textarea{width:100%;resize:vertical}.duty-obligation-actions{margin-top:12px;align-items:center}.duty-obligation-card .practice-subsection{margin-top:16px}


/* ==========================================================
   v0.62l – Layout-Feinschliff
   ========================================================== */
body.survey-control-visible .doctor-grid tbody tr.upcoming-dispensated-row td:nth-child(n+17):nth-child(-n+22) {
    background:linear-gradient(var(--nfd-dispensation-overlay),var(--nfd-dispensation-overlay)),var(--nfd-upcoming-bg) !important;
}
body.survey-control-visible .combo-grid tbody tr.upcoming-dispensated-row td:nth-child(n+17):nth-child(-n+22) {
    background:linear-gradient(var(--nfd-dispensation-overlay),var(--nfd-dispensation-overlay)),var(--nfd-upcoming-bg) !important;
}
body[data-theme="intensiv"] {
    --nfd-group-bg:#d8e0f5; --nfd-group-header-bg:#bdcaee; --nfd-group-hover-bg:#ccd7f2; --nfd-group-border:#2456a4;
    --nfd-age-missing-bg:#ef8e89; --nfd-age-missing-text:#681515;
    --nfd-missing-soft-bg:rgba(242,176,36,.25); --nfd-missing-soft-border:rgba(171,116,0,.30);
}
body[data-theme="dunkel"] {
    --nfd-group-border:#6f9ee8;
    --nfd-age-missing-bg:#613638; --nfd-age-missing-text:#ffc0bd;
    --nfd-missing-soft-bg:rgba(188,139,42,.16); --nfd-missing-soft-border:rgba(218,173,76,.20);
}
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child),
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):nth-child(even),
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child) td.c-sticky,
body[data-theme="dunkel"] .combo-grid tbody tr:not(.combo-practice-row):not(.combo-group-child):nth-child(even) td.c-sticky { background:var(--surface) !important; }

/* Praxis-Kopfzeile bleibt auch innerhalb der Zeitblöcke sichtbar kräftiger. */
.combo-grid tbody tr.combo-practice-row td.freeze-cell {
    background:linear-gradient(rgba(244,246,247,.30),rgba(244,246,247,.30)),var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.current-cell {
    background:linear-gradient(rgba(250,251,252,.20),rgba(250,251,252,.20)),var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.upcoming-cell {
    background:linear-gradient(rgba(255,246,241,.28),rgba(255,246,241,.28)),var(--nfd-group-header-bg) !important;
}
.combo-grid tbody tr.combo-practice-row td.comments-cell {
    background:linear-gradient(rgba(251,250,247,.18),rgba(251,250,247,.18)),var(--nfd-group-header-bg) !important;
}

/* Alterssemantik hat auch innerhalb eines Praxisblocks Vorrang vor der Gruppenfläche. */
.combo-grid tbody tr.combo-group-child td.age-cell.age-60 { background:var(--nfd-age-60-bg) !important; }
.combo-grid tbody tr.combo-group-child td.age-cell.age-65 { background:var(--nfd-age-65-bg) !important; font-weight:650; }
.combo-grid tbody tr.combo-group-child td.age-cell.age-70 { background:var(--nfd-age-70-bg) !important; font-weight:750; }
.combo-grid tbody tr.combo-group-child td.age-cell.age-missing {
    background:var(--nfd-age-missing-bg) !important; color:var(--nfd-age-missing-text) !important; font-weight:800;
}

/* v0.62l2: Missing-Info-Felder als direkte Bearbeitungs-Shortcuts. */
.missing-info-link-cell{padding:0 !important;}
.missing-info-link{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:30px;padding:5px 7px;box-sizing:border-box;color:inherit;text-decoration:none;cursor:pointer;}
.missing-info-link:hover{text-decoration:none;box-shadow:inset 0 0 0 2px rgba(15,92,110,.28);}
body[data-theme="dunkel"] .missing-info-link:hover{box-shadow:inset 0 0 0 2px rgba(132,203,216,.42);}

/* v0.62p – Mutationssperre auch fuer Dienstplaner unuebersehbar */
.mutation-lock-banner{margin:10px 14px 0;padding:10px 14px;border:1px solid #c98b20;border-radius:7px;background:#fff3cd;color:#5f4300;display:flex;gap:8px 14px;align-items:center;flex-wrap:wrap;font-size:13px;box-sizing:border-box}
.mutation-lock-banner strong{font-size:13px;letter-spacing:.02em}.mutation-lock-banner em{font-style:normal;opacity:.9}
.planner-lock-banner{border-width:2px;background:#ffe7a3;color:#503500}
body[data-theme="intensiv"] .mutation-lock-banner{background:#ffdf78;border-color:#a86700;color:#3d2900}
body[data-theme="dunkel"] .mutation-lock-banner{background:#4a3c1f;border-color:#d6a83d;color:#ffe6a3}

/* v0.62p3 – DP-Hinweis innerhalb der Sidebar; verändert die Listenhöhe nicht. */
.sidebar>.planner-lock-banner{margin:8px 7px 2px;padding:9px 10px;border:2px solid #f2c14e;border-radius:6px;background:#6b4b00;color:#fff3c4;display:grid;gap:3px;font-size:11px;line-height:1.25;box-sizing:border-box}.sidebar>.planner-lock-banner strong{font-size:12px;color:#fff}.sidebar>.planner-lock-banner em{font-style:normal;opacity:.92}body[data-theme="intensiv"] .sidebar>.planner-lock-banner{background:#7a4d00;border-color:#ffd05a}body[data-theme="dunkel"] .sidebar>.planner-lock-banner{background:#4a3c1f;border-color:#d6a83d;color:#ffe6a3}
