/* Mieter-Verwaltung – moderne Strukturansicht (Viverea) */

.mt-page-head {
    margin-bottom: 2rem;
}

.mt-page-head h1 {
    font-size: 1.625rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.mt-page-head p {
    font-size: 0.9375rem;
    color: var(--on-bg-muted);
    max-width: 36rem;
    line-height: 1.5;
}

.modal-body .form-hint {
    font-size: 0.75rem;
    color: var(--on-bg-muted);
    margin: -0.5rem 0 1rem;
    line-height: 1.45;
}

.modal-body select {
    width: 100%;
    padding: 0.72rem 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--on-bg);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

.modal-body select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.modal-body select:focus {
    border-color: var(--accent, #3a7bff);
    box-shadow: 0 0 0 3px rgba(41, 151, 255, 0.12);
}

.mt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 0.35rem 0;
}

.mt-search-wrap {
    flex: 1;
    min-width: min(100%, 300px);
    max-width: 480px;
}

.mt-search {
    width: 100%;
    height: 44px;
    padding: 0 1rem 0 2.75rem;
    background: var(--bg-1, #fff);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    color: var(--on-bg);
    font-size: 0.9rem;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' fill='none' stroke='%23a1a1aa' stroke-width='1.75'%3E%3Ccircle cx='7.5' cy='7.5' r='5.25'/%3E%3Cpath d='M12 12l4 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
}

.mt-search::placeholder {
    color: var(--on-bg-muted);
}

.mt-search:focus {
    border-color: rgba(41, 151, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(41, 151, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mt-toolbar .btn-p {
    height: 44px;
    padding: 0 1.25rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(41, 151, 255, 0.25);
}

.mt-structure {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ── Liegenschaft (Accordion) ── */
.mt-prop {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    background: var(--bg-1, #fff);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s, box-shadow 0.25s, transform 0.2s;
}

.mt-prop:hover {
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.mt-prop.is-open {
    border-color: rgba(41, 151, 255, 0.15);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

.mt-prop-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: background 0.15s;
}

.mt-prop-head:hover {
    background: rgba(0, 0, 0, 0.02);
}

.mt-prop-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(41, 151, 255, 0.12), rgba(41, 151, 255, 0.04));
    color: var(--accent, #3a7bff);
}

.mt-prop-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
}

.mt-prop-chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--on-bg-muted);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s, color 0.15s;
}

.mt-prop.is-open .mt-prop-chevron {
    transform: rotate(90deg);
    color: var(--accent, #3a7bff);
    background: rgba(41, 151, 255, 0.08);
}

.mt-prop-chevron svg {
    width: 18px;
    height: 18px;
}

.mt-prop-main {
    flex: 1;
    min-width: 0;
}

.mt-prop-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--on-bg);
    letter-spacing: -0.02em;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.mt-prop-addr {
    font-size: 0.8125rem;
    color: var(--on-bg-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.mt-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--on-bg-dim);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.mt-pill-val {
    font-weight: 650;
    color: var(--on-bg);
    font-variant-numeric: tabular-nums;
}

.mt-pill-free {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.mt-pill-free .mt-pill-val {
    color: #b45309;
}

.mt-prop-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid transparent;
}

.mt-prop.is-open .mt-prop-body {
    grid-template-rows: 1fr;
    border-top-color: rgba(0, 0, 0, 0.05);
}

.mt-prop-body-inner {
    overflow: hidden;
    min-height: 0;
}

.mt-units {
    padding: 0.5rem 0 0.65rem;
}

.mt-units-head {
    display: grid;
    grid-template-columns: minmax(120px, 1.1fr) minmax(140px, 1.4fr) minmax(120px, 1.2fr) 90px 100px auto;
    gap: 0.75rem 1rem;
    padding: 0.5rem 1.35rem 0.5rem 4.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--on-bg-muted);
}

.mt-unit-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.1fr) minmax(140px, 1.4fr) minmax(120px, 1.2fr) 90px 100px auto;
    gap: 0.75rem 1rem;
    align-items: center;
    padding: 0.75rem 1.35rem 0.75rem 4.5rem;
    margin: 0 0.5rem;
    border-radius: 12px;
    transition: background 0.15s;
}

.mt-unit-row:hover {
    background: rgba(0, 0, 0, 0.025);
}

.mt-unit-row.is-free {
    opacity: 1;
}

.mt-unit-row.is-free .mt-tenant-free {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--on-bg-muted);
    background: rgba(0, 0, 0, 0.04);
    letter-spacing: 0.02em;
}

.mt-unit-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--on-bg);
    letter-spacing: -0.01em;
}

.mt-unit-sub {
    font-size: 0.75rem;
    color: var(--on-bg-muted);
    margin-top: 0.2rem;
}

.mt-tenant-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.mt-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--accent, #3a7bff);
    background: linear-gradient(145deg, rgba(41, 151, 255, 0.14), rgba(41, 151, 255, 0.06));
}

.mt-tenant-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--on-bg);
    letter-spacing: -0.01em;
}

.mt-tenant-meta {
    font-size: 0.8125rem;
    color: var(--on-bg-muted);
    line-height: 1.45;
}

.mt-col-date {
    font-size: 0.8125rem;
    color: var(--on-bg-dim);
    font-variant-numeric: tabular-nums;
}

.mt-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.mt-badge-active {
    background: var(--success-dim);
    color: var(--success);
}

.mt-badge-planned {
    background: var(--indigo-dim);
    color: var(--indigo);
}

.mt-badge-terminated,
.mt-badge-ended {
    background: rgba(0, 0, 0, 0.05);
    color: var(--on-bg-muted);
}

.mt-row-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
    opacity: 0.65;
    transition: opacity 0.15s;
}

.mt-unit-row:hover .mt-row-actions,
.mt-unassigned-row:hover .mt-row-actions {
    opacity: 1;
}

.mt-row-actions .btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border-color: rgba(0, 0, 0, 0.08);
    background: var(--bg-1, #fff);
}

.mt-btn-ghost {
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    background: var(--bg-1, #fff);
    color: var(--on-bg-dim);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.mt-btn-ghost:hover {
    background: var(--accent, #3a7bff);
    border-color: var(--accent, #3a7bff);
    color: #fff;
}

.mt-prop-empty-units {
    padding: 1.25rem 1.35rem 1.25rem 4.5rem;
    font-size: 0.875rem;
    color: var(--on-bg-muted);
}

.mt-prop-empty-units a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}

.mt-prop-empty-units a:hover {
    text-decoration: underline;
}

/* ── Nicht zugewiesen ── */
.mt-section-unassigned {
    margin-top: 2.5rem;
    padding-top: 0;
}

.mt-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.mt-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--on-bg);
    text-transform: none;
    margin: 0;
}

.mt-section-sub {
    font-size: 0.8125rem;
    color: var(--on-bg-muted);
    margin: 0;
}

.mt-unassigned-list {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    background: var(--bg-1);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.mt-unassigned-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.5fr) minmax(140px, 1.3fr) minmax(120px, 1fr) auto;
    gap: 0.75rem 1rem;
    align-items: center;
    padding: 0.9rem 1.35rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s;
}

.mt-unassigned-row:last-child {
    border-bottom: none;
}

.mt-unassigned-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.mt-loading {
    padding: 4rem 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--on-bg-muted);
}

.mt-no-results {
    padding: 3rem 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--on-bg-muted);
    background: var(--bg-1);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    border-radius: 16px;
}

.mt-no-results a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}

mark.mt-hit {
    background: rgba(41, 151, 255, 0.2);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

/* Mieter-Modal: Vertragsblock */
.mt-modal-contract-wrap {
    margin-top: 0.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mt-modal-contract-head {
    font-size: 0.6875rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--on-bg-muted);
    margin-bottom: 0.75rem;
}

.mt-contract-hint,
.mt-contract-sub {
    font-size: 0.875rem;
    color: var(--on-bg-muted);
    line-height: 1.5;
    margin: 0;
}

.mt-contract-sub {
    margin-top: 0.5rem;
    font-weight: 500;
    color: var(--on-bg-dim);
}

.mt-contract-grid {
    display: grid;
    grid-template-columns: minmax(5rem, auto) 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
    align-items: baseline;
}

.mt-contract-grid dt {
    margin: 0;
    color: var(--on-bg-muted);
    font-weight: 500;
    font-size: 0.78rem;
}

.mt-contract-grid dd {
    margin: 0;
    font-weight: 500;
    color: var(--on-bg);
}

.mt-contract-docs {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    font-size: 0.8125rem;
}

.mt-contract-docs-head {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--on-bg-dim);
    margin-bottom: 0.35rem;
}

.mt-contract-docs ul {
    margin: 0.25rem 0 0 1.1rem;
    padding: 0;
    color: var(--on-bg-muted);
    line-height: 1.45;
}

.mt-contract-docs-empty {
    color: var(--on-bg-muted);
    line-height: 1.45;
}

.mt-modal-contract-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.mt-modal-contract-actions .mt-contract-detail-link {
    text-decoration: none;
}

.mt-contract-fields input[type="date"],
.mt-contract-fields input[type="number"],
.mt-contract-fields select {
    width: 100%;
    padding: 0.72rem 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--on-bg);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

.mt-contract-fields input:focus,
.mt-contract-fields select:focus {
    border-color: var(--accent, #3a7bff);
    box-shadow: 0 0 0 2px rgba(41, 151, 255, 0.12);
}

.mt-field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--on-bg-muted);
}

.mt-input-suffix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mt-input-suffix input {
    flex: 1;
}

.mt-input-suffix span {
    font-size: 0.8125rem;
    color: var(--on-bg-muted);
    white-space: nowrap;
}

.mt-all-contracts-link:hover {
    color: var(--accent, #2563eb);
    text-decoration: underline;
}

.mt-contract-summary {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.mt-contract-section-title {
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--on-bg-muted);
    margin: 1rem 0 0.65rem;
}

.mt-contract-upload-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mt-upload-zone {
    position: relative;
    border: 1.5px dashed rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s, background 0.2s;
}

.mt-upload-zone:hover,
.mt-upload-zone.dragover {
    border-color: var(--accent, #3a7bff);
    background: rgba(41, 151, 255, 0.04);
}

.mt-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.mt-upload-zone-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(41, 151, 255, 0.08);
    color: var(--accent, #3a7bff);
}

.mt-upload-zone-icon svg {
    width: 22px;
    height: 22px;
}

.mt-upload-zone-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--on-bg-dim);
}

.mt-upload-zone-hint {
    font-size: 0.6875rem;
    color: var(--on-bg-muted);
    margin-top: 0.25rem;
}

.mt-upload-progress {
    height: 3px;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.mt-upload-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent, #3a7bff);
    transition: width 0.25s ease;
}

.mt-upload-list-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--on-bg-muted);
    margin: 0.75rem 0 0.35rem;
}

.mt-upload-file-list {
    display: grid;
    gap: 0.5rem;
}

.mt-upload-done {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.mt-upload-done-icon svg {
    width: 18px;
    height: 18px;
}

.mt-upload-done-info {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
}

.mt-upload-done-info strong {
    display: block;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mt-upload-done-info span {
    font-size: 0.6875rem;
    color: var(--on-bg-muted);
}

.mt-upload-open {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.75rem !important;
    text-decoration: none;
    white-space: nowrap;
}

.mt-upload-done-remove {
    border: none;
    background: transparent;
    color: var(--on-bg-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
}

.mt-upload-done-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

@media (max-width: 1024px) {
    .mt-units-head {
        display: none;
    }

    .mt-unit-row,
    .mt-unassigned-row {
        grid-template-columns: 1fr 1fr;
        padding-left: 1.35rem;
        margin: 0 0.35rem;
    }

    .mt-unit-row .mt-col-date,
    .mt-unit-row .mt-badge-wrap,
    .mt-unit-row .mt-row-actions {
        grid-column: 1 / -1;
    }

    .mt-pills {
        display: none;
    }

    .mt-prop-icon {
        display: none;
    }
}

@media (max-width: 640px) {
    .mt-unit-row,
    .mt-unassigned-row {
        grid-template-columns: 1fr;
    }

    .mt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .mt-search-wrap {
        max-width: none;
    }

    .mt-toolbar .btn-p {
        width: 100%;
        justify-content: center;
    }

    .mt-page-head h1 {
        font-size: 1.375rem;
    }
}
