/* ── Maßnahmenplan-Modul ─────────────────────────────────────────────────── */

/* ── Layout ─────────────────────────────────────────────────────────────── */
.mn-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    box-sizing: border-box;
}

.mn-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Plan Grid ───────────────────────────────────────────────────────────── */
.mn-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.mn-plan-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    padding: 18px;
    cursor: pointer;
    transition: box-shadow .15s, transform .1s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mn-plan-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
    transform: translateY(-2px);
}

.mn-plan-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin: 0;
    line-height: 1.3;
}

.mn-plan-card-sub {
    font-size: .82rem;
    color: var(--text-muted, #64748b);
}

.mn-plan-card-prog-label {
    font-size: .78rem;
    color: var(--text-muted, #64748b);
    text-align: right;
    margin-top: -6px;
}

/* ── Plan Stats Chips ────────────────────────────────────────────────────── */
.mn-plan-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.mn-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.mn-chip-total      { background: #f1f5f9; color: #475569; }
.mn-chip-offen      { background: #dbeafe; color: #1d4ed8; }
.mn-chip-erledigt   { background: #dcfce7; color: #15803d; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.mn-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
}
.mn-progress-fill {
    height: 100%;
    background: var(--primary, #005BBF);
    border-radius: 3px;
    transition: width .3s ease;
}
.mn-prog-kat .mn-progress-fill {
    background: rgba(255, 255, 255, .7);
}

/* ── Breadcrumb / Detail Header ──────────────────────────────────────────── */
.mn-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mn-back-link {
    color: var(--primary, #005BBF);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
    border-radius: 4px;
    transition: opacity .1s;
}
.mn-back-link:hover { opacity: .75; }

.mn-breadcrumb-sep {
    color: var(--text-muted, #64748b);
    font-size: 1rem;
}

.mn-plan-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    flex: 1;
}

/* ── Stats Strip ─────────────────────────────────────────────────────────── */
.mn-stats-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mn-stat-box {
    flex: 1;
    min-width: 90px;
    padding: 12px 16px;
    border-radius: var(--radius, 8px);
    text-align: center;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
}

.mn-stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.mn-stat-lbl {
    font-size: .73rem;
    color: var(--text-muted, #64748b);
    margin-top: 3px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mn-stat-total        { border-top: 3px solid #94a3b8; }
.mn-stat-total .mn-stat-num { color: #475569; }

.mn-stat-offen        { border-top: 3px solid #3b82f6; }
.mn-stat-offen .mn-stat-num { color: #1d4ed8; }

.mn-stat-inbearbeitung { border-top: 3px solid #f59e0b; }
.mn-stat-inbearbeitung .mn-stat-num { color: #d97706; }

.mn-stat-erledigt     { border-top: 3px solid #22c55e; }
.mn-stat-erledigt .mn-stat-num { color: #15803d; }

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.mn-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.mn-search-input {
    flex: 1;
    min-width: 180px;
    max-width: 320px;
}

.mn-filter-bar .form-control:not(.mn-search-input) {
    min-width: 140px;
    max-width: 200px;
}

/* ── Category Sections (accordion) ──────────────────────────────────────── */
.mn-section {
    margin-bottom: 10px;
    border-radius: var(--radius, 8px);
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
}

.mn-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--primary, #005BBF);
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.mn-section-header:hover {
    background: var(--primary-hover, #004AA8);
}

.mn-kat-count {
    font-size: .78rem;
    opacity: .8;
    white-space: nowrap;
    flex-shrink: 0;
}

.mn-section-arrow {
    font-size: .8rem;
    transition: transform .2s;
    flex-shrink: 0;
}
.mn-section-arrow.mn-collapsed {
    transform: rotate(-90deg);
}

.mn-section-body {
    /* visible by default */
}
.mn-section-body.mn-hidden {
    display: none;
}

/* ── Task Row ────────────────────────────────────────────────────────────── */
.mn-task-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}
.mn-task-row:last-child {
    border-bottom: none;
}
.mn-task-row:hover {
    background: #f8fafc;
}
.mn-task-row.mn-expanded {
    background: #f0f6ff;
}
.mn-task-row.mn-expanded:hover {
    background: #e8f0fe;
}

.mn-task-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
}

.mn-task-pos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 22px;
    padding: 0 6px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    color: #475569;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.mn-task-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mn-task-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mn-task-sub {
    font-size: .75rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mn-status-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.mn-prog-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.mn-prog-inline {
    width: 60px;
    flex-shrink: 0;
}

.mn-prog-bar-inline {
    height: 4px;
    border-radius: 2px;
}

.mn-prog-pct {
    font-size: .72rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

.mn-termin {
    font-size: .78rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
}

.mn-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ── Task Detail (expanded) ──────────────────────────────────────────────── */
.mn-task-detail {
    padding: 12px 14px 14px 56px;
    background: #f8fafc;
    border-top: 1px solid var(--border, #e2e8f0);
    font-size: .85rem;
}

.mn-detail-row {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    line-height: 1.5;
}

.mn-detail-label {
    font-weight: 700;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    min-width: 100px;
    font-size: .8rem;
}

.mn-detail-dates {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: .78rem;
    color: var(--text-muted, #64748b);
}

.mn-detail-dates span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.mn-empty {
    text-align: center;
    color: var(--text-muted, #64748b);
    padding: 48px 24px;
    font-size: .95rem;
    line-height: 2;
}

/* ── Dialogs ─────────────────────────────────────────────────────────────── */
.mn-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mn-dialog-overlay.hidden {
    display: none;
}

.mn-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    width: min(520px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.mn-dialog-wide {
    width: min(720px, 96vw);
}

.mn-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    flex-shrink: 0;
}
.mn-dialog-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.mn-dialog-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}

.mn-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border, #e2e8f0);
    flex-shrink: 0;
}

/* ── Abgabe-Verlauf im Dialog ────────────────────────────────────────────── */
.mn-dlg-hist-label {
    font-size: .75rem;
    color: var(--text-muted, #64748b);
    margin-bottom: 4px;
    font-weight: 500;
}
.mn-dlg-hist-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
}
.mn-dlg-hist-date {
    font-size: .82rem;
    color: #94a3b8;
    flex: 1;
}
.mn-dlg-hist-btn {
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: .75rem;
    cursor: pointer;
    line-height: 1.4;
    transition: background .12s;
}
.mn-dlg-hist-restore { color: var(--primary, #005BBF); border-color: var(--primary, #005BBF); }
.mn-dlg-hist-restore:hover { background: #eff6ff; }
.mn-dlg-hist-del { color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
.mn-dlg-hist-del:hover { background: #fef2f2; }

/* ── Toggle-Label (Checkbox + Text) ─────────────────────────────────────── */
.mn-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-main, #0f172a);
    user-select: none;
}
.mn-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #005BBF);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Zugriff (Access) Rows ───────────────────────────────────────────────── */
.mn-zugriff-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.mn-zugriff-row:last-of-type {
    border-bottom: none;
}

.mn-zugriff-user {
    flex: 1;
    font-size: .875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Grid (Excel-like table) ─────────────────────────────────────────────── */
.mn-wrap-full {
    padding: 12px 14px;
}

.mn-grid-outer {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mn-grid-scroll {
    flex: 1;
    overflow-x: auto;            /* keep touchpad/gesture scrolling */
    overflow-y: auto;
    min-height: 0;
    max-height: calc(100vh - 280px);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px) var(--radius, 8px) 0 0;
    background: var(--surface, #fff);
    /* Hide native scrollbar — sticky bar below is the visible control */
    scrollbar-width: none;       /* Firefox */
}
.mn-grid-scroll::-webkit-scrollbar {
    display: none;               /* Chrome / Safari / Edge */
}

/* Sticky horizontal scrollbar always visible at the bottom */
.mn-grid-hscroll {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    flex-shrink: 0;
    border: 1px solid var(--border, #e2e8f0);
    border-top: none;
    border-radius: 0 0 var(--radius, 8px) var(--radius, 8px);
    background: var(--surface, #fff);
}

.mn-grid-hscroll-inner {
    height: 1px;
    min-width: 100%;
    pointer-events: none;
}

.mn-grid {
    border-collapse: collapse;
    table-layout: fixed;   /* required for col/th widths to be respected */
    width: max-content;    /* exactly as wide as sum of column widths */
    font-size: .82rem;
}

/* Sticky header */
.mn-grid thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.mn-grid-head th {
    background: var(--primary, #005BBF);
    color: #fff;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-right: 1px solid rgba(255,255,255,.15);
    white-space: normal;
    user-select: none;
    font-size: .78rem;
    letter-spacing: .02em;
}
.mn-grid-head th:last-child { border-right: none; }

/* Category header rows */
.mn-kat-row td {
    background: #1e3a5f;
    color: #e2eaf6;
    font-size: .78rem;
    font-weight: 600;
    padding: 6px 8px;
    border-top: 2px solid var(--primary, #005BBF);
    letter-spacing: .03em;
}

/* Collapse toggle button inside category header */
.mn-kat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255,255,255,.12);
    border-radius: 4px;
    cursor: pointer;
    color: #e2eaf6;
    font-size: .68rem;
    margin-right: 6px;
    flex-shrink: 0;
    transition: background .15s, transform .15s;
    vertical-align: middle;
}
.mn-kat-toggle:hover { background: rgba(255,255,255,.25); }
.mn-kat-collapsed .mn-kat-toggle { background: rgba(255,255,255,.08); }

/* "No category" group row — muted slate, visually distinct from real categories */
.mn-kat-row-none td {
    background: #4a5568;
    color: #e2e8f0;
    border-top-color: #718096;
    font-style: italic;
}
.mn-kat-row-none .mn-kat-toggle {
    background: rgba(255,255,255,.10);
}
.mn-kat-row-none .mn-kat-count-chip,
.mn-kat-row-none .mn-kat-pct-chip {
    background: rgba(255,255,255,.12);
    color: #e2e8f0;
}

/* Quick-add row */
.mn-quickadd-row td {
    padding: 4px 12px;
    background: #f8fafc;
    border-top: 1px dashed #d0dce8;
}

.mn-quickadd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--primary, #005BBF);
    font-size: .8rem;
    padding: 3px 6px;
    border-radius: 4px;
    opacity: .7;
    transition: opacity .1s, background .1s;
}
.mn-quickadd-btn:hover { opacity: 1; background: #e8f0fb; }

.mn-quickadd-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.mn-quickadd-form.hidden { display: none; }
.mn-quickadd-btn.hidden  { display: none; }

.mn-quickadd-input {
    flex: 1;
    max-width: 480px;
    padding: 4px 8px;
    border: 1px solid var(--primary, #005BBF);
    border-radius: 4px;
    font-size: .83rem;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,91,191,.15);
}

.mn-quickadd-hint {
    font-size: .73rem;
    color: #94a3b8;
    white-space: nowrap;
}

.mn-kat-pos-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.18);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Courier New', monospace;
    font-size: .74rem;
    margin-right: 6px;
}

.mn-kat-count-chip,
.mn-kat-pct-chip {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 500;
    margin-left: 8px;
    opacity: .85;
}
.mn-kat-count-chip { background: rgba(255,255,255,.15); }
.mn-kat-pct-chip   { background: rgba(255,255,255,.1); }

/* Data rows */
.mn-grid-row {
    transition: background .08s;
    border-bottom: 1px solid #f1f5f9;
}
.mn-grid-row:last-child { border-bottom: none; }
.mn-grid-row:hover      { background: #f8fafc; }

/* Cells */
.mn-cell {
    padding: 7px 10px;
    vertical-align: middle;
    cursor: pointer;
    border-right: 1px solid #f1f5f9;
    position: relative;
    min-height: 36px;
    color: var(--text-main, #0f172a);
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: break-word;
}
.mn-cell:last-child { border-right: none; }
.mn-cell:hover {
    background: #e8f0fe;
    outline: 1.5px solid var(--primary, #005BBF);
    outline-offset: -1.5px;
    z-index: 1;
}
.mn-cell-editing {
    background: #fff !important;
    outline: 2px solid var(--primary, #005BBF) !important;
    outline-offset: -2px !important;
    padding: 3px 4px !important;
    z-index: 2;
}

.mn-cell-mono { font-family: 'Courier New', monospace; font-size: .78rem; color: #475569; }
.mn-cell-date { font-size: .78rem; color: var(--text-muted, #64748b); }

/* ── Abgabe-Termin: current + history ───────────────────────────────────── */
.mn-abgabe-cur {
    display: block;
    font-weight: 500;
    color: var(--text-main, #0f172a);
}
.mn-abgabe-cur.mn-abgabe-overdue {
    color: #dc2626;
    font-weight: 600;
}
.mn-abgabe-cur.mn-abgabe-overdue::after {
    content: ' ⚠';
    font-size: .7em;
}
.mn-abgabe-hist {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}
.mn-abgabe-hist-item {
    font-size: .72rem;
    color: #94a3b8;
    text-decoration: line-through;
    text-decoration-color: #94a3b8;
    white-space: nowrap;
}
.mn-cell-long { max-width: 220px; }

.mn-cell-aufgabe-text {
    font-weight: 500;
    white-space: pre-wrap;
    word-break: break-word;
}

.mn-cell-long-text {
    font-size: .78rem;
    color: var(--text-muted, #64748b);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Inline input/select/textarea inside editing cell */
.mn-cell-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: .82rem;
    color: var(--text-main, #0f172a);
    padding: 2px 4px;
    resize: vertical;
    min-height: 28px;
}
.mn-cell-input[type="number"] { width: 70px; }
select.mn-cell-input { cursor: pointer; }

/* Progress cell */
.mn-cell-prog-td {
    vertical-align: middle;
    cursor: pointer;
    border-right: 1px solid #f1f5f9;
    padding: 7px 8px;
}
.mn-cell-prog-td:hover {
    background: #e8f0fe;
    outline: 1.5px solid var(--primary, #005BBF);
    outline-offset: -1.5px;
}
.mn-inline-prog {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: #e2e8f0;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    flex-shrink: 0;
}
.mn-inline-prog-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .2s;
}
.mn-prog-num {
    font-size: .72rem;
    color: var(--text-muted, #64748b);
    vertical-align: middle;
    white-space: nowrap;
}

/* Badge */
.mn-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .71rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Actions column */
.mn-cell-actions {
    padding: 4px 6px;
    text-align: center;
    white-space: nowrap;
    border-right: none;
    vertical-align: middle;
}
.mn-act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: .8rem;
    color: var(--text-muted, #64748b);
    transition: background .1s, color .1s, border-color .1s;
    padding: 0;
}
.mn-act-btn:hover { background: #f1f5f9; color: var(--text-main, #0f172a); }
.mn-act-edit { margin-right: 3px; }
.mn-act-kat  { margin-right: 3px; }
.mn-act-kat:hover  { color: var(--primary, #005BBF); border-color: var(--primary, #005BBF); background: #eff6ff; }
.mn-act-del:hover  { color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); background: #fef2f2; }

/* ── Kategorie Quick-Picker ──────────────────────────────────────────────── */
.mn-kat-picker {
    position: fixed;
    z-index: 10000;
    background: #fff;
    border: 1px solid #c8d6e5;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
    min-width: 180px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
}

.mn-kat-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-main, #0f172a);
    transition: background .1s;
}

.mn-kat-picker-item:hover { background: #eef4fb; }

.mn-kat-picker-item.active {
    color: var(--primary, #005BBF);
    font-weight: 600;
}

.mn-kat-picker-item.active::before {
    content: '✓';
    font-size: .75rem;
    width: 12px;
    flex-shrink: 0;
}

.mn-kat-picker-item:not(.active)::before {
    content: '';
    width: 12px;
    flex-shrink: 0;
}

.mn-kat-picker-none {
    color: var(--text-muted, #64748b) !important;
    font-style: italic;
}

/* Row state indicators */
.mn-row-saving { opacity: .65; }
.mn-row-saved  { background: #f0fdf4 !important; }
.mn-row-error  { background: #fef2f2 !important; }

/* Save toast */
.mn-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    animation: mnToastIn .2s ease;
}
.mn-toast-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
@keyframes mnToastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Column resize handle ────────────────────────────────────────────────── */
.mn-col-resize {
    position: absolute;
    top: 0; right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 2;
}
.mn-col-resize:hover { background: rgba(255,255,255,.35); }

/* ── Row height variants – applied as class on .mn-grid-scroll ───────────── */
/* Use shorthand to override original shorthand (same specificity, later in file wins) */
.mn-rh-compact .mn-cell,
.mn-rh-compact .mn-cell-actions { padding: 2px 8px; }

.mn-rh-tall .mn-cell,
.mn-rh-tall .mn-cell-actions { padding: 16px 10px; }

/* ── Row height toggle button group ─────────────────────────────────────── */
.mn-rh-group {
    display: flex;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    overflow: hidden;
}
.mn-rh-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 8px;
    height: 32px;
    color: var(--text-muted, #64748b);
    display: flex; align-items: center;
    border-right: 1px solid var(--border, #e2e8f0);
    transition: background .1s, color .1s;
}
.mn-rh-btn:last-child { border-right: none; }
.mn-rh-btn:hover { background: #f1f5f9; color: var(--text-main, #0f172a); }
.mn-rh-btn.active { background: var(--primary, #005BBF); color: #fff; }

/* ── Kategorie column ────────────────────────────────────────────────────── */
.mn-cell-kat {
    font-size: .78rem;
    color: var(--primary, #005BBF);
    font-weight: 500;
}

/* ── Multi-Select Status ─────────────────────────────────────────────────── */
.mn-ms-wrap { position: relative; flex-shrink: 0; }

.mn-ms-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    background: var(--surface, #fff);
    color: var(--text-main, #0f172a);
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
    height: 36px;
    box-sizing: border-box;
    gap: 0;
    transition: border-color .15s, background .15s;
}
.mn-ms-btn:hover { border-color: var(--primary, #005BBF); background: #f8fafc; }

.mn-ms-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1000;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 6px;
    min-width: 200px;
    flex-direction: column;
    gap: 2px;
}
.mn-ms-menu.mn-ms-open { display: flex; }

.mn-ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .84rem;
    transition: background .1s;
    user-select: none;
}
.mn-ms-option:hover { background: #f1f5f9; }
.mn-ms-option input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--primary, #005BBF);
    cursor: pointer;
    flex-shrink: 0;
}

.mn-ms-actions {
    border-top: 1px solid var(--border, #e2e8f0);
    padding-top: 6px;
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
}
.mn-ms-clear {
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: .78rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.mn-ms-clear:hover { color: var(--danger, #dc2626); background: #fef2f2; }

/* ── Category Management Dialog rows ────────────────────────────────────── */
.mn-katdlg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}
.mn-katdlg-row:last-child { border-bottom: none; }
.mn-kat-row-pos { flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mn-plan-grid {
        grid-template-columns: 1fr;
    }

    .mn-stats-strip {
        gap: 8px;
    }

    .mn-stat-box {
        min-width: 70px;
        padding: 10px 12px;
    }

    .mn-stat-num {
        font-size: 1.2rem;
    }

    .mn-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .mn-search-input,
    .mn-filter-bar .form-control:not(.mn-search-input) {
        max-width: 100%;
        min-width: 0;
    }

    .mn-task-main {
        flex-wrap: wrap;
        gap: 8px;
    }

    .mn-task-info {
        min-width: 0;
        flex-basis: calc(100% - 46px);
    }

    .mn-prog-wrap,
    .mn-termin {
        flex-basis: auto;
    }

    .mn-task-detail {
        padding-left: 14px;
    }

    .mn-breadcrumb {
        gap: 6px;
    }

    .mn-plan-title {
        font-size: 1rem;
    }

    .mn-dialog,
    .mn-dialog-wide {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
}

/* ── PDS Mitarbeiter Combobox ────────────────────────────────────────────── */
.mn-combo-wrap {
    position: relative;
    width: 100%;
}

.mn-combo-wrap .form-control {
    width: 100%;
    box-sizing: border-box;
}

.mn-combo-drop {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 320px;
    width: max-content;
    max-width: 480px;
    background: #fff;
    border: 1px solid #c8d6e5;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    max-height: 260px;
    overflow-y: auto;
    z-index: 9999;
}

.mn-combo-drop:empty {
    display: none;
}

.mn-combo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background .1s;
    border-bottom: 1px solid #f0f4f8;
}

.mn-combo-item:last-child {
    border-bottom: none;
}

.mn-combo-item:hover,
.mn-combo-item:focus {
    background: #eef4fb;
    outline: none;
}

.mn-combo-nr {
    font-size: 0.75rem;
    color: #7a8fa6;
    white-space: nowrap;
    flex-shrink: 0;
    background: #f0f4f8;
    padding: 1px 6px;
    border-radius: 4px;
}

.mn-combo-name {
    flex: 1;
    font-weight: 500;
    color: #1e3a5f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mn-combo-hint {
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #7a8fa6;
    text-align: center;
}

.mn-combo-loading {
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #7a8fa6;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ── M365 combobox extras ────────────────────────────────────────────────── */
.mn-combo-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: .02em;
}

.mn-combo-tag-m365 {
    background: #0078d4;
    color: #fff;
}

.mn-combo-sub {
    font-size: .72rem;
    color: #7a8fa6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}
