/* ── Vertragsmanagement ─────────────────────────────────────────────────── */

.vtm-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    height: 100%;
    box-sizing: border-box;
}

/* Toolbar */
.vtm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.vtm-toolbar-left,
.vtm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Alert-Chips */
.vtm-alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
}
.vtm-chip-critical {
    background: #fee2e2;
    color: #dc2626;
}
.vtm-chip-warning {
    background: #fef3c7;
    color: #d97706;
}

/* Filterleiste */
.vtm-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.vtm-search {
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}
.vtm-filter-select {
    min-width: 140px;
    max-width: 200px;
}
.vtm-filter-bar-2 {
    margin-top: -4px;
}
.vtm-filter-reset {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: .82rem;
    color: var(--text-muted);
}

/* Tabellen-Wrapper */
.vtm-table-wrap {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
}

/* Tabelle */
.vtm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.vtm-table thead tr {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}
.vtm-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.vtm-row {
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid #f1f5f9;
}
.vtm-row:hover {
    background: #f8fafc;
}
/* Urgency */
.vtm-row.vtm-urgent-expired {
    background: #fff5f5;
}
.vtm-row.vtm-urgent-expired:hover {
    background: #fee2e2;
}
.vtm-row.vtm-urgent-critical {
    background: #fffbeb;
}
.vtm-row.vtm-urgent-critical:hover {
    background: #fef3c7;
}
.vtm-row.vtm-urgent-warning {
    background: #fefce8;
}

.vtm-td {
    padding: 10px 14px;
    vertical-align: middle;
}
.vtm-td-name {
    min-width: 180px;
}
.vtm-bezeichnung {
    font-weight: 600;
    color: var(--text);
    display: block;
}
.vtm-sub {
    font-size: .73rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}
.vtm-td-date {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .83rem;
}
.vtm-td-rest {
    white-space: nowrap;
}
.vtm-td-wert {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Badges */
.vtm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
}
.vtm-badge-expired  { background: #fee2e2; color: #dc2626; }
.vtm-badge-critical { background: #fef3c7; color: #d97706; }
.vtm-badge-warning  { background: #fefce8; color: #ca8a04; }

.vtm-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
.vtm-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vtm-dialog-overlay.hidden {
    display: none;
}
.vtm-dialog {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    width: min(560px, 96vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.vtm-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.vtm-dialog-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.vtm-dialog-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.vtm-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.vtm-dialog-footer .btn:first-child {
    margin-right: auto;
}

/* ── PDS Partner-Suche ──────────────────────────────────────────────────── */
.vtm-partner-wrap {
    position: relative;
}

/* Ausgewählter Partner als Chip */
.vtm-partner-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid #2563eb44;
    border-radius: var(--radius, 6px);
    background: #f0f6ff;
    font-size: .875rem;
    margin-bottom: 0;
}
.vtm-partner-chip.hidden {
    display: none;
}
.vtm-chip-clear {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 2px;
    border-radius: 3px;
    transition: color .1s;
}
.vtm-chip-clear:hover {
    color: #dc2626;
}

/* Ergebnis-Dropdown */
.vtm-partner-drop {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 0 0 var(--radius, 6px) var(--radius, 6px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    max-height: 260px;
    overflow-y: auto;
    z-index: 100;
}
.vtm-partner-drop.hidden {
    display: none;
}

.vtm-pd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background .1s;
    font-size: .875rem;
    border-bottom: 1px solid #f8fafc;
}
.vtm-pd-item:hover {
    background: #f0f6ff;
}
.vtm-pd-item:last-child {
    border-bottom: none;
}

/* Typ-Badge K / L */
.vtm-pd-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 800;
    flex-shrink: 0;
}

.vtm-pd-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vtm-pd-ges {
    font-size: .73rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.vtm-pd-empty {
    padding: 14px 12px;
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}

/* ── Dialog-Breite erhöhen für mehr Felder ──────────────────────────────── */
.vtm-dialog {
    width: min(680px, 96vw) !important;
}

/* ── Abschnitts-Trennlinie ──────────────────────────────────────────────── */
.vtm-section-sep {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 10px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
}
.vtm-section-sep::before,
.vtm-section-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #e2e8f0);
}

/* ── Zahlungs-Detailblock ───────────────────────────────────────────────── */
.vtm-zahlung-block {
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}
.vtm-zahlung-block .form-group {
    margin-bottom: 8px;
}
.vtm-zahlung-block .form-group:last-child {
    margin-bottom: 0;
}
.vtm-zahlung-block label {
    font-size: .8rem !important;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Checkbox-Zeile ─────────────────────────────────────────────────────── */
.vtm-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    user-select: none;
}
.vtm-check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary, #2563eb);
}

/* ── Datei-Upload ───────────────────────────────────────────────────────── */
.vtm-file-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    font-size: .875rem;
    color: var(--text-muted);
    background: #f8fafc;
    transition: border-color .15s, background .15s, color .15s;
    width: 100%;
    box-sizing: border-box;
}
.vtm-file-label:hover {
    border-color: var(--primary, #2563eb);
    background: #eff6ff;
    color: var(--primary, #2563eb);
}
.vtm-file-label .vtm-file-name {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

/* ── Anhang-Chip (bestehende Datei) ─────────────────────────────────────── */
.vtm-anhang-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: .875rem;
}
.vtm-anhang-chip .vtm-anhang-icon {
    color: #dc2626;
    font-size: 1rem;
    flex-shrink: 0;
}
.vtm-anhang-chip .vtm-anhang-chip-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vtm-anhang-replace-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: .8rem;
    color: var(--text-muted);
}

/* ── Zahlungsverbindung Preview-Card ────────────────────────────────────── */
.vtm-zv-card {
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 14px;
    background: #f0f6ff;
    font-size: .875rem;
}
.vtm-zv-card-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-size: .9rem;
}
.vtm-zv-art-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: .74rem;
    font-weight: 700;
    white-space: nowrap;
}
.vtm-zv-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    font-size: .84rem;
    border-top: 1px solid #dbeafe;
}
.vtm-zv-row span:first-child {
    color: var(--text-muted);
    font-size: .76rem;
    min-width: 110px;
    flex-shrink: 0;
}
.vtm-zv-notiz {
    color: var(--text-muted);
    font-size: .8rem !important;
    gap: 6px;
}

/* ── ZV-Badge in der Tabellenliste ──────────────────────────────────────── */
.vtm-zv-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
