.tenant-management-page {
    min-width: 0;
}

.tenant-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
    gap: 16px;
    min-width: 0;
    align-items: start;
}

.tenant-list-pane,
.tenant-detail-pane {
    min-width: 0;
}

.tenant-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, .45fr) auto;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.tenant-filter-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.tenant-filter-field label,
.tenant-detail-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.tenant-filter-field input,
.tenant-filter-field select,
.tenant-detail-form input {
    width: 100%;
    min-width: 0;
}

.tenant-filter-actions {
    align-items: end;
}

.tenant-list-labels {
    display: grid;
    gap: 10px;
    min-width: 0;
}

/* 行のレイアウトと状態表示は共通admin-list-rowに委譲する。 */
.tenant-row {
    min-width: 0;
}

.tenant-list-labels {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.tenant-cell {
    display: grid;
    min-width: 0;
    align-content: center;
    overflow-wrap: anywhere;
}

.tenant-cell-name {
    gap: 3px;
}

.tenant-cell-name strong {
    color: var(--navy);
    font-size: 13px;
}

.tenant-cell-name small,
.tenant-cell-slug,
.tenant-cell-updated {
    color: var(--muted);
    font-size: 11px;
}

.tenant-cell-counts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 500;
}

.tenant-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 26px;
    border: 1px solid currentColor;
    border-radius: var(--ui-corner-radius);
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.tenant-status-active {
    color: #087748;
    background: #eaf8f1;
}

.tenant-status-inactive {
    color: #a33b12;
    background: #fff1e8;
}

.tenant-list-message,
.tenant-detail-empty {
    padding: 28px 16px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.tenant-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
}

.tenant-pagination span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.tenant-detail-head {
    align-items: start;
}

.tenant-detail-head .icon-button {
    flex: 0 0 auto;
}

.tenant-detail-content {
    display: grid;
    gap: 18px;
    min-width: 0;
    padding: 16px;
}

.tenant-detail-form {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.tenant-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.tenant-detail-span {
    grid-column: 1 / -1;
}

.tenant-detail-form .field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.tenant-detail-form small,
.tenant-detail-note,
.tenant-detail-meta {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.tenant-detail-note {
    margin: 0;
}

.tenant-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.tenant-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.tenant-summary > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 10px;
}

.tenant-summary dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.tenant-summary dd {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tenant-detail-actions {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.tenant-detail-actions h3 {
    margin: 0;
    color: var(--navy);
    font-size: 14px;
}

.tenant-feedback {
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--blue);
    border-radius: var(--ui-corner-radius);
    padding: 10px 12px;
    background: #f5f7ff;
    color: var(--navy);
    font-size: 13px;
    font-weight: 500;
}

.tenant-feedback[hidden] {
    display: none;
}

.tenant-feedback.error {
    border-left-color: #bd2c43;
    background: #fff2f3;
    color: #8e1c2f;
}

.tenant-feedback.success {
    border-left-color: #087748;
    background: #eefaf4;
    color: #075c39;
}

.tenant-status-dialog {
    width: min(520px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    border: 1px solid var(--line);
    border-radius: var(--ui-corner-radius);
    padding: 0;
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow);
}

.tenant-status-dialog::backdrop {
    background: rgba(8, 8, 95, .35);
}

.tenant-status-dialog-card {
    display: grid;
    min-width: 0;
}

.tenant-status-dialog-body {
    display: grid;
    gap: 8px;
    padding: 16px;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.6;
}

.tenant-status-dialog-body p {
    margin: 0;
}

.tenant-status-dialog-actions {
    justify-content: end;
    border-top: 1px solid var(--line);
    padding: 12px 16px;
}

.tenant-management-page .danger,
.tenant-management-page .danger-outline {
    border-color: #bd2c43;
}

.tenant-management-page .danger {
    background: #bd2c43;
    color: #fff;
}

.tenant-management-page .danger-outline {
    color: #8e1c2f;
    background: #fff;
}

@media (max-width: 1023px) {
    .admin-list-surface--tenants {
        --admin-list-columns: minmax(0, 1.1fr) minmax(0, .75fr) minmax(0, .5fr) minmax(0, 1.2fr) minmax(0, .8fr);
    }

    .tenant-list-labels {
        gap: 8px;
        padding-right: 12px;
        padding-left: 12px;
    }

    .tenant-filter-form {
        grid-template-columns: minmax(0, 1fr) minmax(130px, .5fr);
    }

    .tenant-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .tenant-workspace-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tenant-filter-form,
    .tenant-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tenant-filter-actions {
        grid-column: auto;
    }

    .tenant-filter-actions > * {
        flex: 1 1 0;
    }

    .tenant-list-labels {
        display: none;
    }

    .tenant-cell {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: 7.5em minmax(0, 1fr);
        gap: 6px;
        align-items: baseline;
    }

    .tenant-cell-counts {
        grid-template-columns: 7.5em repeat(3, minmax(0, 1fr));
    }

    .tenant-cell-counts::before {
        grid-row: 1;
    }

    .tenant-cell-counts span {
        min-width: 0;
    }

    .tenant-cell-status,
    .tenant-cell-updated {
        grid-template-columns: 7.5em minmax(0, 1fr);
    }

    .tenant-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .tenant-detail-content {
        padding: 14px;
    }

    .tenant-status-dialog-actions {
        align-items: stretch;
    }

    .tenant-status-dialog-actions > * {
        flex: 1 1 0;
    }
}

.tenant-list-stale {
    color: var(--red, #d5263f);
    border-bottom: 1px solid var(--line, #e2e8f0);
}
